<template>
  <base-breadcrumb :title="breadcrumb">
    <a-spin
      tip="处理中..."
      :spinning="processing"
    >
      <a-form-model
        ref="form1"
        :model="form"
        :rules="rules"
      >
        <a-card
          :body-style="{ padding: '24px 32px' }"
          :bordered="false"
        >
          <a-tabs
            ref="tabs"
            :active-key="nextSteps"
            @change="callback"
          >
            <a-tab-pane
              :key="1"
              tab="基本信息"
            >
              <a-spin
                tip="项目信息加载中..."
                :spinning="spinning"
              >
                <div>
                  <a-row :gutter="24">
                    <a-col
                      :md="8"
                      :sm="8"
                    >
                      <a-form-model-item
                        label="工程承包模式"
                        :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                        :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
                        prop="contractModelCode"
                      >
                        <a-select
                          v-model="form.contractModelCode"
                          placeholder="请选择"
                          :get-popup-container="getPopupContainer"
                          :disabled="isProjectApproval || !!projectId"
                          @select="selectChange"
                        >
                          <a-select-option
                            v-for="d in selectDatas.projectContractingModel"
                            :key="d.code"
                            :value="d.code"
                          >
                            {{ d.name }}
                          </a-select-option>
                        </a-select>
                      </a-form-model-item>
                    </a-col>
                    <a-col
                      :md="8"
                      :sm="8"
                    >
                      <a-form-model-item
                        label="承包类型"
                        :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                        :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
                        prop="innerPackageCode"
                      >
                        <a-select
                          v-model="form.innerPackageCode"
                          placeholder="请选择"
                          :get-popup-container="getPopupContainer"
                          :disabled="isProjectApproval || !!projectId"
                          @change="isInnerPackage"
                        >
                          <a-select-option :value="0">
                            自主承包
                          </a-select-option>
                          <a-select-option :value="1">
                            内部承包
                          </a-select-option>
                        </a-select>
                      </a-form-model-item>
                    </a-col>
                    <a-col
                      v-if="isContract"
                      :md="8"
                      :sm="8"
                    >
                      <a-form-model-item
                        label="专业承包公司"
                        :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                        :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
                        prop="contractBranchs"
                      >
                        <a-select
                          v-model="form.contractBranchs"
                          :get-popup-container="getPopupContainer"
                          mode="multiple"
                          :disabled="isProjectApproval"
                        >
                          <a-select-option
                            v-for="d in contractingBranchs"
                            :key="d.orgId"
                            :value="d.orgId"
                          >
                            {{
                              d.orgName
                            }}
                          </a-select-option>
                        </a-select>
                      </a-form-model-item>
                    </a-col>
                    <template v-if="isGeneral">
                      <a-col
                        :md="8"
                        :sm="8"
                      >
                        <a-form-model-item
                          label="总承包项目是否内部项目"
                          :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                          :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
                          prop="epcIsInnerProject"
                        >
                          <a-select
                            v-model="form.epcIsInnerProject"
                            placeholder="请选择"
                            :get-popup-container="getPopupContainer"
                            :disabled="isProjectApproval || !!projectId"
                          >
                            <a-select-option :value="0">
                              否
                            </a-select-option>
                            <a-select-option :value="1">
                              是
                            </a-select-option>
                          </a-select>
                        </a-form-model-item>
                      </a-col>
                      <template v-if="isEpcIsInnerProject">
                        <a-col
                          :md="8"
                          :sm="8"
                        >
                          <a-form-model-item
                            v-if="isEpcIsInnerProject"
                            label="总承包项目"
                            :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                            :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
                            prop="epcProjectId"
                          >
                            <a-select
                              v-model="form.epcProjectId"
                              show-search
                              :filter-option="filterEpcProjectId"
                              placeholder="请选择"
                              :get-popup-container="getPopupContainer"
                              :disabled="isProjectApproval"
                              @change="handleEpcProjectIdChange"
                            >
                              <a-select-option
                                v-for="item in epcIsInnerProjectList"
                                :key="item.projectId"
                              >
                                {{ item.projectName }}
                              </a-select-option>
                            </a-select>
                          </a-form-model-item>
                        </a-col>
                        <a-col
                          :md="8"
                          :sm="8"
                        >
                          <a-form-model-item
                            label="分包合同额（万）"
                            :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                            :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
                            prop="subContractAmount"
                          >
                            <BaseInputNumber
                              v-model="form.subContractAmount"
                              :precision="2"
                              :step="0.01"
                              :min="0"
                              style="width: 100%"
                              placeholder="请输入"
                            />
                          </a-form-model-item>
                        </a-col>
                        <a-col
                          :md="24"
                          :sm="24"
                        >
                          <a-form-model-item
                            label="备注"
                            :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                            :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
                            prop="remark"
                          >
                            <BaseTextarea
                              v-model="form.remark"
                              placeholder="请输入"
                              :disabled="isProjectApproval"
                              class="clear-required"
                            />
                          </a-form-model-item>
                        </a-col>
                      </template>
                      <a-col
                        v-else
                        :md="8"
                        :sm="8"
                      >
                        <a-form-model-item
                          label="总承包项目"
                          :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                          :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
                          prop="generalContractorCompanyName"
                        >
                          <BaseInput
                            v-model="form.generalContractorCompanyName"
                            placeholder="请输入总承包单位"
                            :disabled="isProjectApproval"
                          />
                        </a-form-model-item>
                      </a-col>
                    </template>
                    <a-col
                      :md="8"
                      :sm="8"
                    >
                      <a-form-model-item
                        label="项目备案名称"
                        :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                        :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
                        prop="projectName"
                      >
                        <BaseInput
                          v-model="form.projectName"
                          placeholder="输入项目备案名称"
                          :disabled="isProjectApproval || isEpcIsInnerProject"
                        />
                      </a-form-model-item>
                    </a-col>
                    <a-col
                      :md="8"
                      :sm="8"
                    >
                      <a-form-model-item
                        label="项目简称"
                        :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                        :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
                        prop="projectOmit"
                      >
                        <BaseInput
                          v-model="form.projectOmit"
                          placeholder="输入项目简称"
                          :disabled="isProjectApproval || isEpcIsInnerProject"
                        />
                      </a-form-model-item>
                    </a-col>
                    <a-col
                      :md="8"
                      :sm="8"
                    >
                      <a-form-model-item
                        label="项目编号"
                        :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                        :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
                      >
                        <BaseInput
                          v-model="form.projectNum"
                          placeholder="项目编号"
                          disabled
                        />
                      </a-form-model-item>
                    </a-col>
                    <a-col
                      :md="8"
                      :sm="8"
                    >
                      <a-form-model-item
                        label="中标时间"
                        :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                        :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
                        prop="winningTime"
                      >
                        <a-date-picker
                          v-model="form.winningTime"
                          format="YYYY-MM-DD"
                          placeholder="中标时间"
                          :disabled="isProjectApproval || isEpcIsInnerProject"
                        />
                      </a-form-model-item>
                    </a-col>
                    <a-col
                      :md="8"
                      :sm="8"
                    >
                      <a-form-model-item
                        label="一级地域"
                        :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                        :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
                        prop="oneAreaCode"
                      >
                        <a-select
                          v-model="form.oneAreaCode"
                          placeholder="请选择"
                          :get-popup-container="getPopupContainer"
                          :disabled="isProjectApproval || isEpcIsInnerProject"
                          @select="getOneArea"
                        >
                          <a-select-option
                            v-for="item in areaDicts"
                            :key="item.id"
                            :value="item.id"
                          >
                            {{
                              item.name
                            }}
                          </a-select-option>
                        </a-select>
                      </a-form-model-item>
                    </a-col>
                    <a-col
                      :md="8"
                      :sm="8"
                    >
                      <a-form-model-item
                        label="二级地域"
                        :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                        :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
                        prop="secondAreaCode"
                      >
                        <a-select
                          v-model="form.secondAreaCode"
                          placeholder="请选择"
                          :get-popup-container="getPopupContainer"
                          :disabled="isProjectApproval || isEpcIsInnerProject"
                          @change="getTwoArea"
                        >
                          <a-select-option
                            v-for="item in areaDicts2"
                            :key="item.id"
                            :value="item.id"
                          >
                            {{
                              item.name
                            }}
                          </a-select-option>
                        </a-select>
                      </a-form-model-item>
                    </a-col>
                    <a-col
                      :md="8"
                      :sm="8"
                    >
                      <a-form-model-item
                        label="三级地域"
                        :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                        :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
                      >
                        <a-select
                          v-model="form.threeAreaCode"
                          allow-clear
                          placeholder="请选择"
                          :get-popup-container="getPopupContainer"
                          :disabled="isProjectApproval || isEpcIsInnerProject"
                          @change="getThreeArea"
                        >
                          <a-select-option
                            v-for="item in areaDicts3"
                            :key="item.id"
                            :value="item.id"
                          >
                            {{
                              item.name
                            }}
                          </a-select-option>
                        </a-select>
                      </a-form-model-item>
                    </a-col>
                    <a-col
                      :md="8"
                      :sm="8"
                      style="position: relative"
                    >
                      <a-form-model-item
                        label="四级地域"
                        :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                        :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
                      >
                        <a-select
                          v-model="form.fourAreaCode"
                          allow-clear
                          placeholder="请选择"
                          :get-popup-container="getPopupContainer"
                          :disabled="isProjectApproval || isEpcIsInnerProject"
                          @change="getFourArea"
                        >
                          <a-select-option
                            v-for="item in areaDicts4"
                            :key="item.id"
                            :value="item.id"
                          >
                            {{
                              item.name
                            }}
                          </a-select-option>
                        </a-select>
                      </a-form-model-item>
                    </a-col>
                    <a-col
                      :md="8"
                      :sm="8"
                    >
                      <a-form-model-item
                        ref="longitude"
                        label="地理坐标"
                        :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                        :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
                        :prop="setFormProp"
                      >
                        <div style="display: flex;align-items: center;justify-content: space-between">
                          <BaseInputNumber
                            v-model="form.longitude"
                            style="margin-right: 20px; width: 95px !important; "
                            placeholder="经度"
                            :disabled="isProjectApproval || isEpcIsInnerProject"
                            @change="getLongitude"
                            @blur="() => { $refs.longitude.onFieldBlur() }"
                          />
                          <BaseInputNumber
                            v-model="form.latitude"
                            style="width: 95px !important;"
                            placeholder="纬度"
                            :disabled="isProjectApproval || isEpcIsInnerProject"
                            @blur="() => { $refs.longitude.onFieldBlur() }"
                            @change="getLatitude"
                          />
                          <!--<img   src="../../../../assets/icons/mapIcon.png" style="width: 32px;height: 32px"/>-->
                          <img
                            v-if="!isProjectApproval || isEpcIsInnerProject"
                            src="../../../../assets/icons/mapIcon.png"
                            style="width: 32px;height: 32px"
                            @click="getMapModel"
                          >
                        </div>
                      </a-form-model-item>
                    </a-col>
                    <!--<a-col :md="8" :sm="8">-->
                    <!--<a-form-model-item-->
                    <!--label="详细地址"-->
                    <!--:labelCol="{ lg: { span: 7 }, sm: { span: 7 } }"-->
                    <!--:wrapperCol="{ lg: { span: 17}, sm: { span: 17 } }" prop="projectAddress">-->
                    <!--<BaseInput-->
                    <!--v-model="form.projectAddress"-->
                    <!--placeholder="输入详细地址 "-->
                    <!--type="textarea"/>-->
                    <!--</a-form-model-item>-->
                    <!--</a-col>-->

                    <a-col
                      :md="24"
                      :sm="24"
                    >
                      <a-form-model-item
                        label="详细地址"
                        :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                        :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
                        prop="projectAddress"
                      >
                        <BaseTextarea
                          v-model="form.projectAddress"
                          placeholder="输入详细地址 "
                          :disabled="isProjectApproval || isEpcIsInnerProject"
                        />
                      </a-form-model-item>
                    </a-col>
                    <a-col
                      :md="8"
                      :sm="8"
                    >
                      <a-form-model-item
                        label="区域一级管辖单位(所属办事处)"
                        :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                        :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
                        :prop="setAreaProp"
                      >
                        <a-select
                          v-show="setAreaProp === 'jurisdictionOneCode'"
                          key="jurisdictionOneCode"
                          v-model="form.jurisdictionOneCode"
                          placeholder="请选择"
                          :disabled="isProjectApproval || isEpcIsInnerProject"
                          allow-clear
                          :get-popup-container="getPopupContainer"
                        >
                          <a-select-option
                            v-for="item in managementLists"
                            :key="item.code"
                            :value="item.code"
                          >
                            {{
                              item.name
                            }}
                          </a-select-option>
                        </a-select>
                        <a-select
                          v-show="setAreaProp !== 'jurisdictionOneCode'"
                          key="jurisdictionOneCodeFake"
                          v-model="form.jurisdictionOneCode"
                          placeholder="请选择"
                          :disabled="isProjectApproval || isEpcIsInnerProject"
                          :get-popup-container="getPopupContainer"
                          class="unRequiredFormItem"
                        >
                          <a-select-option
                            v-for="item in managementLists"
                            :key="item.code"
                            :value="item.code"
                          >
                            {{
                              item.name
                            }}
                          </a-select-option>
                        </a-select>
                      </a-form-model-item>
                    </a-col>
                    <a-col
                      :md="8"
                      :sm="8"
                    >
                      <a-form-model-item
                        label="区域二级管辖单位(所属办事处)"
                        :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                        :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
                      >
                        <a-select
                          v-model="form.jurisdictionTwoCode"
                          allow-clear
                          placeholder="请选择"
                          :disabled="isProjectApproval || isEpcIsInnerProject"
                          :get-popup-container="getPopupContainer"
                        >
                          <a-select-option
                            v-for="item in agenciesLists"
                            :key="item.code"
                            :value="item.code"
                          >
                            {{
                              item.name
                            }}
                          </a-select-option>
                        </a-select>
                      </a-form-model-item>
                    </a-col>
                    <a-col
                      :md="8"
                      :sm="8"
                    >
                      <a-form-model-item
                        label="签约单位"
                        :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                        :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
                        prop="signUnitId"
                      >
                        <!-- <a-auto-complete
                          v-model="form.contractUnit"
                          :data-source="selectDatas.contractUnitList"
                          placeholder="请选择"
                          :disabled="isProjectApproval || isEpcIsInnerProject"
                          :filter-option="contractUnitFilterOption"
                          @change="contractUnitChange"
                        /> -->
                        <a-select 
                          v-model="form.signUnitId"
                          :disabled="isProjectApproval || isEpcIsInnerProject"
                          @change="contractUnitChange"
                          placeholder="请选择">
                          <a-select-option :key="item.id" :value="item.id" v-for="item in contractUnitList">
                            {{ item.name }}
                          </a-select-option>
                        </a-select>
                      </a-form-model-item>
                    </a-col>
                    <a-col
                      :md="8"
                      :sm="8"
                    >
                      <a-form-model-item
                        label="承接名义"
                        :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                        :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
                        prop="undertakeCode"
                      >
                        <a-select
                          v-model="form.undertakeCode"
                          placeholder="请选择"
                          :get-popup-container="getPopupContainer"
                          :disabled="undertakeCodeDisabled || isProjectApproval || isEpcIsInnerProject"
                        >
                          <a-select-option
                            v-for="d in selectDatas.continuesTheNominal"
                            :key="d.code"
                            :value="d.code"
                          >
                            {{ d.name }}
                          </a-select-option>
                        </a-select>
                      </a-form-model-item>
                    </a-col>
                    <a-col
                      :md="8"
                      :sm="8"
                    >
                      <a-form-model-item
                        label="实施单位(所属二级单位)"
                        :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                        :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
                      >
                        <!--<BaseInput-->
                        <!---->
                        <!--v-decorator="['implementationTwo', { rules: [{ required: true, message: ' ' }] }]"-->
                        <!--name="name"-->
                        <!--placeholder=""-->
                        <!--disabled-->
                        <!--/>-->
                        <BaseInput
                          v-model="twoCompany"
                          disabled
                          placeholder=""
                        />
                      </a-form-model-item>
                    </a-col>
                    <a-col
                      :md="8"
                      :sm="8"
                    >
                      <a-form-model-item
                        label="实施单位(所属三级单位)"
                        :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                        :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
                        prop="implementationThree"
                      >
                        <a-select
                          v-model="form.implementationThree"
                          :get-popup-container="getPopupContainer"
                          placeholder="请选择"
                          :disabled="isProjectApproval"
                          label-in-value
                          @change="implementationThreeChange"
                        >
                          <a-select-option
                            v-for="d in companyList"
                            :key="d.orgId"
                            :value="d.orgId"
                          >{{ d.orgName }}</a-select-option>
                          <!-- 这里不能换行不然会导首尾致意外空格 -->
                        </a-select>
                      </a-form-model-item>
                    </a-col>
                    <a-col
                      :md="8"
                      :sm="8"
                    >
                      <a-form-model-item
                        label="项目类型"
                        :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                        :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
                        prop="projectTypeCode"
                      >
                        <a-select
                          v-model="form.projectTypeCode"
                          placeholder="请选择"
                          :disabled="isProjectApproval || isEpcIsInnerProject"
                          :get-popup-container="getPopupContainer"
                          @change="getProType"
                        >
                          <a-select-option
                            v-for="item in typeNames"
                            :key="item.typeId"
                            :value="item.typeId"
                          >
                            {{
                              item.typeName
                            }}
                          </a-select-option>
                        </a-select>
                      </a-form-model-item>
                    </a-col>
                    <a-col
                      :md="8"
                      :sm="8"
                    >
                      <a-form-model-item
                        label="项目业态"
                        :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                        :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
                        prop="projectFormatCode"
                      >
                        <a-select
                          v-model="form.projectFormatCode"
                          placeholder="请选择"
                          :disabled="isProjectApproval || isEpcIsInnerProject"
                          :get-popup-container="getPopupContainer"
                          mode="multiple"
                        >
                          <a-select-option
                            v-for="d in projectForm"
                            :key="d.code"
                            :value="d.code"
                          >
                            {{ d.name }}
                          </a-select-option>
                        </a-select>
                      </a-form-model-item>
                    </a-col>
                    <a-col
                      :md="8"
                      :sm="8"
                    >
                      <a-form-model-item
                        label="结构类型"
                        :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                        :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
                        prop="structureTypeCode"
                      >
                        <a-select
                          v-model="form.structureTypeCode"
                          placeholder="请选择"
                          :disabled="isProjectApproval || isEpcIsInnerProject"
                          :get-popup-container="getPopupContainer"
                        >
                          <a-select-option
                            v-for="d in selectDatas.structureType"
                            :key="d.code"
                            :value="d.code"
                          >
                            {{ d.name }}
                          </a-select-option>
                        </a-select>
                      </a-form-model-item>
                    </a-col>
                    <a-col
                      :md="24"
                      :sm="24"
                    >
                      <a-form-model-item
                        label="风险条件"
                        key="riskCondition"
                        :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                        :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
                        prop="riskCondition"
                      >
                        <TreeSelect :value="form.riskCondition" @change="onRiskConditionChange" :disabled="isProjectApproval || isEpcIsInnerProject" />
                      </a-form-model-item>
                    </a-col>
                    <a-col
                      :md="8"
                      :sm="8"
                    >
                      <a-form-model-item
                        label="项目重要程度"
                        :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                        :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
                        prop="projectImportanceCode"
                      >
                        <a-select
                          v-model="form.projectImportanceCode"
                          placeholder="请选择"
                          :disabled="isProjectApproval || isEpcIsInnerProject || disabledByRiskCondition"
                          :get-popup-container="getPopupContainer"
                          @change="getIsImpotant"
                        >
                          <a-select-option
                            v-for="item in importantNamesRenderList"
                            :key="item.importantId"
                            :value="item.importantId"
                          >
                            {{ item.importantName }}
                          </a-select-option>
                        </a-select>
                      </a-form-model-item>
                    </a-col>
                    <a-col
                      :md="8"
                      :sm="8"
                    >
                      <a-form-model-item
                        label="是否为重点项目"
                        :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                        :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
                        prop="keyProjectsCode"
                      >
                        <a-select
                          v-model="form.keyProjectsCode"
                          placeholder="请选择"
                          :get-popup-container="getPopupContainer"
                          disabled
                        >
                          <a-select-option
                            v-for="item in isImportants"
                            :key="item.id"
                            :value="item.id"
                          >
                            {{ item.name }}
                          </a-select-option>
                        </a-select>
                      </a-form-model-item>
                    </a-col>
                    <a-col
                      :md="8"
                      :sm="8"
                    >
                      <a-form-model-item
                        label="工程类型"
                        :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                        :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
                        prop="engineeringTypeId"
                      >
                        <a-select
                          v-model="form.engineeringTypeId"
                          placeholder="请选择"
                          :disabled="isProjectApproval || isEpcIsInnerProject"
                          :get-popup-container="getPopupContainer"
                          @change="engineeringTypeIdChange"
                        >
                          <a-select-option
                            v-for="d in selectDatas.engineeringType"
                            :key="d.code"
                            :value="d.code"
                          >
                            {{ d.name }}
                          </a-select-option>
                        </a-select>
                      </a-form-model-item>
                    </a-col>
                    <a-col
                      :md="8"
                      :sm="8"
                    >
                      <a-form-model-item
                        label="工程性质"
                        :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                        :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
                        prop="projectNatureId"
                      >
                        <a-select
                          v-model="form.projectNatureId"
                          placeholder="请选择"
                          :disabled="isProjectApproval || isEpcIsInnerProject"
                          :get-popup-container="getPopupContainer"
                        >
                          <a-select-option
                            v-for="d in selectDatas.projectNature"
                            :key="d.code"
                            :value="d.code"
                          >
                            {{ d.name }}
                          </a-select-option>
                        </a-select>
                      </a-form-model-item>
                    </a-col>
                    <a-col
                      :md="8"
                      :sm="8"
                    >
                      <a-form-model-item
                        label="局级大客户"
                        :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                        :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
                        prop="bureauCustomerCode"
                      >
                        <a-select
                          v-model="form.bureauCustomerCode"
                          placeholder="请选择"
                          :disabled="isProjectApproval || isEpcIsInnerProject"
                          allow-clear
                          :get-popup-container="getPopupContainer"
                        >
                          <a-select-option
                            v-for="item in bureauCustomers"
                            :key="item.customerId"
                            :value="item.customerId"
                          >
                            {{ item.customerName }}
                          </a-select-option>
                        </a-select>
                      </a-form-model-item>
                    </a-col>
                    <a-col
                      :md="8"
                      :sm="8"
                    >
                      <a-form-model-item
                        label="公司级大客户"
                        :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                        :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
                        prop="companyCustomerCode"
                      >
                        <a-select
                          v-model="form.companyCustomerCode"
                          allow-clear
                          placeholder="请选择"
                          :disabled="isProjectApproval || isEpcIsInnerProject"
                          :get-popup-container="getPopupContainer"
                          @change="getLevelName"
                        >
                          <a-select-option
                            v-for="item in companyCustomers"
                            :key="item.customerId"
                            :value="item.customerId"
                          >
                            {{ item.customerName }}
                          </a-select-option>
                        </a-select>
                      </a-form-model-item>
                    </a-col>
                    <a-col
                      :md="8"
                      :sm="8"
                    >
                      <a-form-model-item
                        label="客户级别"
                        :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                        :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
                        prop=""
                      >
                        <BaseInput
                          v-model="levelName"
                          disabled
                          placeholder=""
                        />
                      </a-form-model-item>
                    </a-col>
                    <a-col
                      :md="8"
                      :sm="8"
                    >
                      <a-form-model-item
                        label="设计单位名称"
                        :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                        :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
                        prop="designUnitName"
                      >
                        <a-select
                          v-model="form.designUnitName"
                          show-search
                          mode="combobox"
                          placeholder="输入/选择"
                          :disabled="isProjectApproval || isEpcIsInnerProject"
                          :filter-option="filterOption"
                          @popupScroll="scrollMore"
                          @change="getDesignUnitId"
                        >
                          <a-select-option
                            v-for="item in tableData"
                            :key="item.id"
                            :value="item.name"
                          >
                            {{ item.name }}
                          </a-select-option>
                        </a-select>
                      </a-form-model-item>
                    </a-col>
                    <a-col
                      :md="8"
                      :sm="8"
                    >
                      <a-form-model-item
                        v-if="!isProjectApproval && !isEpcIsInnerProject"
                        label=""
                        :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                        :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
                      >
                        <a-button
                          type="primary"
                          @click="changeData"
                        >
                          选择
                        </a-button><span>（从设计资源库中选择）</span>
                      </a-form-model-item>
                    </a-col>
                    <a-col
                      :md="8"
                      :sm="8"
                    >
                      <a-form-model-item
                        label="建设单位名称"
                        :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                        :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
                        prop="constructionName"
                      >
                        <BaseInput
                          v-model="form.constructionName"
                          placeholder="输入建设单位名称 "
                          :disabled="isProjectApproval || isEpcIsInnerProject"
                        />
                      </a-form-model-item>
                    </a-col>
                    <a-col
                      :md="8"
                      :sm="8"
                    >
                      <a-form-model-item
                        label="建设单位性质"
                        :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                        :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
                        prop="constructionNatureCode"
                      >
                        <a-select
                          v-model="form.constructionNatureCode"
                          placeholder="请选择"
                          :disabled="isProjectApproval || isEpcIsInnerProject"
                          :get-popup-container="getPopupContainer"
                        >
                          <a-select-option
                            v-for="d in selectDatas.natureOfConstructionUnit"
                            :key="d.code"
                            :value="d.code"
                          >
                            {{ d.name }}
                          </a-select-option>
                        </a-select>
                      </a-form-model-item>
                    </a-col>
                    <a-col
                      :md="8"
                      :sm="8"
                    >
                      <a-form-model-item
                        label="建设单位社会统一信用代码"
                        :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                        :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
                        prop="constructionCode"
                      >
                        <BaseInput
                          v-model="form.constructionCode"
                          placeholder=" 建设单位社会统一信用代码"
                          :disabled="isProjectApproval || isEpcIsInnerProject"
                          style="width: 100%"
                        />
                      </a-form-model-item>
                    </a-col>
                    <a-col
                      :md="8"
                      :sm="8"
                    >
                      <a-form-model-item
                        label="审计单位名称"
                        :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                        :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
                        prop="auditName"
                      >
                        <BaseInput
                          v-model="form.auditName"
                          placeholder=" 审计单位名称"
                          :disabled="isProjectApproval || isEpcIsInnerProject"
                        />
                      </a-form-model-item>
                    </a-col>
                    <a-col
                      :md="8"
                      :sm="8"
                    >
                      <a-form-model-item
                        label="监理单位名称"
                        :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                        :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
                        prop="supervisionName"
                      >
                        <BaseInput
                          v-model="form.supervisionName"
                          placeholder="输入监理单位名称 "
                          :disabled="isProjectApproval || isEpcIsInnerProject"
                        />
                      </a-form-model-item>
                    </a-col>
                    <a-col
                      :md="8"
                      :sm="8"
                    >
                      <a-form-model-item
                        label="勘察单位名称"
                        :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                        :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
                        prop="surveyName"
                      >
                        <BaseInput
                          v-model="form.surveyName"
                          placeholder="输入勘察单位名称"
                          :disabled="isProjectApproval || isEpcIsInnerProject"
                        />
                      </a-form-model-item>
                    </a-col>
                    <a-col
                      :md="8"
                      :sm="8"
                    >
                      <a-form-model-item
                        label="咨询单位名称"
                        :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                        :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
                        prop="consultingName"
                      >
                        <BaseInput
                          v-model="form.consultingName"
                          placeholder="输入咨询单位名称 "
                          :disabled="isProjectApproval || isEpcIsInnerProject"
                        />
                      </a-form-model-item>
                    </a-col>
                    <a-col
                      :md="8"
                      :sm="8"
                    >
                      <a-form-model-item
                        label="是否签订合同"
                        :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                        :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
                        prop="contractCode"
                      >
                        <a-radio-group
                          v-model="form.contractCode"
                          :disabled="isEpcIsInnerProject"
                          @change="contractCodeChange"
                        >
                          <a-radio :value="1">
                            已签订
                          </a-radio>
                          <a-radio :value="0">
                            未签订
                          </a-radio>
                        </a-radio-group>
                      </a-form-model-item>
                    </a-col>
                    <a-col
                      :md="8"
                      :sm="8"
                    />
                    <a-col
                      v-if="isContractMileage"
                      :md="8"
                      :sm="8"
                    >
                      <a-form-model-item
                        label="合同工程里程(km)"
                        :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                        :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
                        prop="contractMileage"
                      >
                        <BaseInputNumber
                          v-model="form.contractMileage"
                          :min="0"
                          placeholder="合同工程里程"
                          style="width: 100%"
                          :disabled="isdiscontractMileage"
                        />
                      </a-form-model-item>
                    </a-col>
                    <template
                      v-if="isConstruction"
                      :gutter="24"
                    >
                      <a-col
                        :md="8"
                        :sm="8"
                      >
                        <a-form-model-item
                          label="合同建筑面积-地上(万m2)"
                          :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                          :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
                          prop="contractAreaGround"
                        >
                          <BaseInputNumber
                            v-model="form.contractAreaGround"
                            :min="0"
                            style="width: 100%"
                            placeholder="合同建筑面积-地上(万m2)"
                            :disabled="isEpcIsInnerProject"
                            @change="groundArea"
                          />
                        </a-form-model-item>
                      </a-col>
                      <a-col
                        :md="8"
                        :sm="8"
                      >
                        <a-form-model-item
                          label="合同建筑面积-地下(万m2)"
                          :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                          :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
                          prop="contractAreaUnderground"
                        >
                          <BaseInputNumber
                            v-model="form.contractAreaUnderground"
                            :min="0"
                            style="width: 100%"
                            placeholder="合同建筑面积-地下(万m2)"
                            :disabled="isEpcIsInnerProject"
                            @change="ungroundArea"
                          />
                        </a-form-model-item>
                      </a-col>
                      <a-col
                        :md="8"
                        :sm="8"
                      >
                        <a-form-model-item
                          label="地上层数"
                          :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                          :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
                          prop="groundFloor"
                        >
                          <BaseInputNumber
                            v-model="form.groundFloor"
                            :min="0"
                            style="width: 100%"
                            placeholder="请输入地上层数"
                            :disabled="isProjectApproval || isEpcIsInnerProject"
                          />
                        </a-form-model-item>
                      </a-col>
                      <a-col
                        :md="8"
                        :sm="8"
                      >
                        <a-form-model-item
                          label="地下层数"
                          style="width: 100%"
                          :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                          :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
                          prop="undergroundFloor"
                        >
                          <BaseInputNumber
                            v-model="form.undergroundFloor"
                            :min="0"
                            style="width: 100%"
                            placeholder="请输入地下层数"
                            :disabled="isProjectApproval || isEpcIsInnerProject"
                          />
                        </a-form-model-item>
                      </a-col>
                      <a-col
                        :md="8"
                        :sm="8"
                      >
                        <a-form-model-item
                          label="合同建筑总面积(万m2)"
                          :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                          :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
                          prop=""
                        >
                          <BaseInputNumber
                            v-model="totalArea"
                            disabled
                            :min="0"
                            style="width: 100%"
                            placeholder="合同建筑总面积(万m2) "
                          />
                        </a-form-model-item>
                      </a-col>
                    </template>
                    <a-col
                      :md="8"
                      :sm="8"
                    >
                      <a-form-model-item
                        label="合同单体工程个数"
                        :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                        :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
                        prop="contractSingleProject"
                      >
                        <BaseInputNumber
                          v-model="form.contractSingleProject"
                          :min="0"
                          :precision="0"
                          style="width: 100%"
                          placeholder="请输入"
                          :disabled="isEpcIsInnerProject"
                        />
                      </a-form-model-item>
                    </a-col>
                    <a-col
                      :md="8"
                      :sm="8"
                    >
                      <a-form-model-item
                        :label="engineeringMetersLabel"
                        :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                        :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
                        prop="engineeringMeters"
                      >
                        <BaseInputNumber
                          v-model="form.engineeringMeters"
                          :min="0"
                          style="width: 100%"
                          name="name"
                          :placeholder="engineeringMetersLabel"
                          :disabled="isProjectApproval || isEpcIsInnerProject"
                        />
                      </a-form-model-item>
                    </a-col>
                    <!--<a-col :md="8" :sm="8">-->
                    <!--<a-form-model-item-->
                    <!--label="维保期时间(年)"-->
                    <!--:labelCol="{ lg: { span: 7 }, sm: { span: 7 } }"-->
                    <!--:wrapperCol="{ lg: { span: 17 }, sm: { span: 17 } }">-->
                    <!--<BaseInputNumber-->
                    <!--style="width: 100%"-->
                    <!--v-decorator="['maintenanceTime',  { rules: [{ required: true, message: ' ' }] }]"-->
                    <!--name="name"-->
                    <!--placeholder=""/>-->
                    <!--</a-form-model-item>-->
                    <!--</a-col>-->

                    <a-col
                      :md="8"
                      :sm="8"
                    >
                      <a-form-model-item
                        label="合同开工日期"
                        :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                        :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
                        prop="contractStartDate"
                      >
                        <a-date-picker
                          v-model="form.contractStartDate"
                          format="YYYY-MM-DD"
                          placeholder="请选择日期"
                          :disabled="isEpcIsInnerProject"
                          @change="getContractStartDate"
                        />
                      </a-form-model-item>
                    </a-col>
                    <a-col
                      :md="8"
                      :sm="8"
                    >
                      <a-form-model-item
                        label="合同竣工日期"
                        :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                        :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
                        prop="contractEndDate"
                      >
                        <a-date-picker
                          v-model="form.contractEndDate"
                          format="YYYY-MM-DD"
                          placeholder="请选择日期"
                          :disabled="isEpcIsInnerProject"
                          @change="getContractEndDate"
                        />
                      </a-form-model-item>
                    </a-col>
                    <a-col
                      :md="8"
                      :sm="8"
                    >
                      <a-form-model-item
                        label="合同工期(天)"
                        :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                        :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
                        prop=""
                      >
                        <BaseInput
                          v-model="form.contractDays"
                          disabled
                          placeholder="合同工期"
                        />
                      </a-form-model-item>
                    </a-col>
                    <a-col
                      :md="8"
                      :sm="8"
                    >
                      <a-form-model-item
                        label="合同额(万)"
                        :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                        :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
                        prop="contractValue"
                      >
                        <BaseInputNumber
                          v-model="form.contractValue"
                          :min="0"
                          style="width: 100%"
                          placeholder="请输入"
                          :disabled="isEpcIsInnerProject"
                          @change="calcEstimateTotalAmount"
                        />
                      </a-form-model-item>
                    </a-col>
                    <a-col
                      :md="8"
                      :sm="8"
                    >
                      <a-form-model-item
                        label="自有施工合同额(万)"
                        :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                        :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
                        prop="ownerContractValue"
                      >
                        <BaseInputNumber
                          v-model="form.ownerContractValue"
                          :min="0"
                          style="width: 100%"
                          :precision="2"
                          placeholder="自有施工合同额(万)"
                          :disabled="isEpcIsInnerProject"
                          @change="calcEstimateTotalAmount"
                        />
                      </a-form-model-item>
                    </a-col>
                    <a-col
                      :md="8"
                      :sm="8"
                    >
                      <a-form-model-item
                        label="专业工程暂估价总额(万)"
                        :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                        :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
                        prop="estimateTotalAmount"
                      >
                        <BaseInputNumber
                          v-model="form.estimateTotalAmount"
                          :min="0"
                          :step="0.01"
                          style="width: 100%"
                          placeholder="专业工程暂估价总额(万)"
                          :disabled="isProjectApproval || isEpcIsInnerProject"
                        />
                      </a-form-model-item>
                    </a-col>
                    <a-col
                      :md="8"
                      :sm="8"
                    >
                      <a-form-model-item
                        label="备案项目经理"
                        :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                        :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
                        prop="projectManager"
                      >
                        <a-select
                          v-model="form.projectManager"
                          placeholder="请选择"
                          :disabled="isProjectApproval || isEpcIsInnerProject"
                          :get-popup-container="getPopupContainer"
                          show-search
                          :filter-option="filterOption"
                          label-in-value
                          @change="getManagerName"
                          @popupScroll="scrollMores"
                          @search="handleSearchManager"
                        >
                          <a-select-option
                            v-for="item in projectManagers"
                            :key="item.id"
                            :value="item.id"
                          >
                            {{ item.name }}({{ item.jobNum }})
                          </a-select-option>
                        </a-select>
                      </a-form-model-item>
                    </a-col>
                    <a-col
                      :md="24"
                      :sm="24"
                    >
                      <a-form-model-item
                        label="项目特点或难点"
                        :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                        :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
                        prop="projectFeatures"
                      >
                        <BaseTextarea
                          v-model="form.projectFeatures"
                          placeholder="项目特点或难点"
                          :disabled="isProjectApproval || isEpcIsInnerProject"
                        />
                      </a-form-model-item>
                    </a-col>
                    <a-col
                      :md="24"
                      :sm="24"
                    >
                      <a-form-model-item
                        label="主施工范围"
                        :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                        :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
                        prop="scopeIdList"
                      >
                        <!-- <BaseTextarea
                          v-model="form.mainScope"
                          placeholder="主施工范围"
                          :disabled="isProjectApproval || isEpcIsInnerProject"
                        /> -->
                        <a-select
                          mode="multiple"
                          v-model="form.scopeIdList" 
                          placeholder="主施工范围" 
                          showArrow
                          :disabled="isProjectApproval || isEpcIsInnerProject">
                          <a-select-option :value="item.id" :key="item.id" v-for="item in mainScopeList">
                            {{ item.scope }}
                          </a-select-option>
                        </a-select>
                      </a-form-model-item>
                    </a-col>
                    <a-col
                      :md="8"
                      :sm="8"
                    >
                      <a-form-model-item
                        label="计划创优级别"
                        :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                        :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
                        prop="excellencePlanCode"
                      >
                        <a-select
                          v-model="form.excellencePlanCode"
                          placeholder="请选择"
                          :disabled="isProjectApproval || isEpcIsInnerProject"
                          :get-popup-container="getPopupContainer"
                        >
                          <a-select-option
                            v-for="d in selectDatas.planExcellenceLevels"
                            :key="d.code"
                            :value="d.code"
                          >
                            {{ d.name }}
                          </a-select-option>
                        </a-select>
                      </a-form-model-item>
                    </a-col>
                    <a-col
                      :md="8"
                      :sm="8"
                    >
                      <a-form-model-item
                        label="计划创优内容"
                        :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                        :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
                        prop="meritContentId"
                      >
                        <a-select
                          v-model="form.meritContentId"
                          placeholder="请选择"
                          :disabled="isProjectApproval || isEpcIsInnerProject"
                          :get-popup-container="getPopupContainer"
                        >
                          <a-select-option
                            v-for="d in selectDatas.meritContentLevels"
                            :key="d.code"
                            :value="d.code"
                          >
                            {{ d.name }}
                          </a-select-option>
                        </a-select>
                      </a-form-model-item>
                    </a-col>
                    <a-col
                      :md="8"
                      :sm="8"
                    >
                      <a-form-model-item
                        label="计划观摩级别"
                        :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                        :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
                        prop="observePlanCode"
                      >
                        <a-select
                          v-model="form.observePlanCode"
                          placeholder="请选择"
                          :disabled="isProjectApproval || isEpcIsInnerProject"
                          :get-popup-container="getPopupContainer"
                        >
                          <a-select-option
                            v-for="d in selectDatas.planToObserveLevels"
                            :key="d.code"
                            :value="d.code"
                          >
                            {{ d.name }}
                          </a-select-option>
                        </a-select>
                      </a-form-model-item>
                    </a-col>
                    <a-col
                      :md="24"
                      :sm="24"
                    >
                      <a-form-model-item
                        label="计划观摩内容"
                        :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                        :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
                        prop="observeContent"
                      >
                        <BaseTextarea
                          v-model="form.observeContent"
                          placeholder="计划观摩内容"
                          :disabled="isProjectApproval || isEpcIsInnerProject"
                        />
                      </a-form-model-item>
                    </a-col>
                  </a-row>
                  <a-button
                    v-if="!isProjectApproval"
                    style="float: right; margin-top: 20px"
                    type="primary"
                    @click="nextStep()"
                  >
                    下一步
                  </a-button>
                </div>
              </a-spin>
            </a-tab-pane>

            <a-tab-pane
              v-if="!isProjectApproval"
              :key="2"
              tab="项目部设置"
            >
              <title-name title="项目领导班子人员配置" />
              <a-table
                :columns="columns"
                :data-source="projectPost"
                bordered
                :pagination="false"
                row-key="id"
              >
                <span
                  slot="serial"
                  slot-scope="text, record, index"
                >{{ index + 1 }}</span>
                <span
                  slot="jobName"
                  slot-scope="text, record"
                >
                  <template>
                    <span
                      v-if="record.requiredCode == 1"
                      class="requireRed"
                    >*</span> {{ record.jobName }} ({{
                      record.canBothName
                    }},{{ record.numberLimitName }})
                  </template>
                </span>
                <span
                  slot="employeeName"
                  slot-scope="record"
                >
                  <template>
                    {{ record.staffList.map((s) => s.staffName).join(',') }}
                  </template>
                </span>
                <span
                  slot="employeeNum"
                  slot-scope="record"
                >
                  <template>
                    <span
                      v-for="(staff, index) in record.staffList"
                      :key="index"
                    >
                      <span
                        v-if="staff.statusCode == 0"
                        style="color: rgba(0, 0, 0, 0.65)"
                      >{{ staff.staffCode }}</span>
                      <span
                        v-else-if="staff.statusCode != 0"
                        style="color: red"
                      >{{ staff.staffCode }}</span>
                      <span v-if="record.staffList && index < record.staffList.length-1 && staff.staffCode">,</span>
                    </span>
                  </template>
                </span>
                <span
                  slot="status"
                  slot-scope="record"
                >
                  <template>
                    {{ record.staffList.map((s) => s.statusName).join(',') }}
                  </template>
                </span>
                <span
                  slot="operation"
                  slot-scope="text, record"
                >
                  <template>
                    <a @click="handleEdit(record)">编辑</a>
                  </template>
                </span>
              </a-table>
              <title-name
                title="其他岗位人员配置"
                style="margin-top: 20px"
              />
              <a-table
                :columns="columns"
                :data-source="otherPost"
                bordered
                :pagination="false"
              >
                <span
                  slot="serial"
                  slot-scope="text, record, index"
                >{{ index + 1 }}</span>
                <span
                  slot="jobName"
                  slot-scope="text, record"
                >
                  <template>
                    <span
                      v-if="record.requiredCode == 1"
                      class="requireRed"
                    >*</span> {{ record.jobName }} ({{
                      record.canBothName
                    }},{{ record.numberLimitName }})
                  </template>
                </span>
                <span
                  slot="employeeName"
                  slot-scope="record"
                >
                  <template>
                    {{ record.staffList.map((s) => s.staffName).join(',') }}
                  </template>
                </span>
                <span
                  slot="employeeNum"
                  slot-scope="record"
                >
                  <template>
                    <span
                      v-for="(staff, index) in record.staffList"
                      :key="staff"
                    >
                      <span v-if="index != 0">,</span>
                      <span
                        v-if="staff.statusCode == 0"
                        style="color: rgba(0, 0, 0, 0.65)"
                      >{{ staff.staffCode }}</span>
                      <span
                        v-else-if="staff.statusCode != 0"
                        style="color: red"
                      >{{ staff.staffCode }}</span>
                    </span>
                  </template>
                </span>
                <span
                  slot="status"
                  slot-scope="record"
                >
                  <template>
                    {{ record.staffList.map((s) => s.statusName).join(',') }}
                  </template>
                </span>
                <span
                  slot="operation"
                  slot-scope="text, record"
                >
                  <template>
                    <a @click="handleEdit(record)">编辑</a>
                  </template>
                </span>
              </a-table>
              <a-button
                style="float: right; margin-top: 20px"
                type="primary"
                @click="nextStep()"
              >
                下一步
              </a-button>
            </a-tab-pane>

            <a-tab-pane
              v-if="!isProjectApproval"
              :key="3"
              tab="附件上传"
            >
              <title-name title="附件上传" />
              <u-table
                :list-url="listUrl"
                :upload-list="uploadList"
                :delete-url="deleteUrl"
                :business-id="businessId"
                business-code="PM01"
                :use-chinese="true"
              />
            </a-tab-pane>
          </a-tabs>

          <!--人员调整-->
          <add-ad-just
            ref="createModal"
            :visible="visible"
            :loading="confirmLoading"
            :model="mdl"
            :extraQuery="{type:0}"
            :data-source-prop="datas"
            :multi="employeeMultiSelect"
            @dataSources="dataSources"
            @employeeNums="employeeNums"
            @employees="changeEmployees"
            @cancel="handleCancel"
            @ok="handleOk"
          />

          <!--设计资源-->
          <a-modal
            v-model="visibles"
            width="900px"
            :title="'设计资源'"
          >
            <template slot="footer">
              <a-button
                key="back"
                @click="handleCancels"
              >
                取消
              </a-button>
              <a-button
                key="submit"
                type="primary"
                @click="handleOks"
              >
                确定选择
              </a-button>
            </template>

            <searchData
              :search-data="searchArr"
              @search="searchDatas"
            />

            <a-table
              bordered
              :pagination="false"
              :row-selection="{ selectedRowKeys: selectedRowKey, onChange: onSelectChange, type: 'radio' }"
              :columns="columnsDesign"
              :data-source="tableData"
              row-key="id"
            >
              <span
                slot="serial"
                slot-scope="text, record, index"
              >{{ index + 1 }}</span>
            </a-table>
            <pagination
              v-model="pageNo"
              :total="totalSize"
              :page-size.sync="pageSize"
              @change="handlePageChange"
              @showSizeChange="showSizeChange"
            />
          </a-modal>

          <!--经纬度-->
          <a-modal
            v-model="visibleMap"
            width="900px"
            style="height:500px;"
            :title="'选择坐标位置'"
          >
            <template slot="footer">
              <a-button
                key="back"
                @click="handleCancelMap"
              >
                取消
              </a-button>
              <a-button
                key="submit"
                type="primary"
                @click="handleOkMap"
              >
                确定选择
              </a-button>
            </template>

            <div>
              <div style="margin-bottom: 20px">
                <BaseInput
                  v-model="keyword"
                  style="width: 100%"
                  placeholder="请输入地址检索"
                />
              </div>

              <baidu-map
                class="bm-view"
                center="成都"
                :zoom="zoom"
                :map-click="false"
                ak="YhMUfwus3Ayed7BpBahtwR5KhFoKVkc0"
                :scroll-wheel-zoom="true"
                @click="getLngLats"
                @ready="getLats"
              >
                <!--搜索-->
                <bm-local-search
                  :keyword="keyword"
                  :auto-viewport="true"
                  :location="location"
                  zoom="12.8"
                  style="display: none"
                />
                <!--缩放-->
                <bm-navigation anchor="BMAP_ANCHOR_TOP_RIGHT" />
                <!--城市列表-->
                <!--<bm-city-list anchor="BMAP_ANCHOR_TOP_LEFT"></bm-city-list>-->
                　　　
                <!-- 标记点组件 -->
                <bm-marker
                  :position="{ lng: lng, lat: lat }"
                  @click="infoWindowOpen()"
                >
                  　　　　　
                  <!-- 信息窗体组件 -->
                  <bm-info-window
                    :title="'详细地址：'"
                    :show="show"
                    :position="{ lng: lng, lat: lat }"
                    @close="infoWindowClose()"
                  >
                    {{ mapAddress }}
                  </bm-info-window>
                </bm-marker>
              </baidu-map>
            </div>
          </a-modal>
        </a-card>

        <div
          style="float: right; margin-bottom: 20px"
          class="page-btn-right-top"
        >
          <a-button
            v-if="!isProjectApproval"
            type="primary"
            @click="saveDraft"
          >
            保存草稿
          </a-button>
          <a-button
            type="primary"
            class="ml12"
            @click="submit"
          >
            提交
          </a-button>
          <a-button
            type="primary"
            class="ml12"
            @click="goBack"
          >
            关闭
          </a-button>
        </div>
      </a-form-model>
    </a-spin>
    <selectApprover
      :businessId="businessId"
      :processConfig="setProcessConfig"
    ></selectApprover>
  </base-breadcrumb>
</template>

<script>
import Vue from 'vue'
import { getDesignResourcesList } from '@/api/design/parameter'
import AddAdJust from './addAdjust'

import BaiduMap from 'vue-baidu-map/components/map/Map.vue' // 百度地图组件
import BmLocalSearch from 'vue-baidu-map/components/search/LocalSearch' // 百度地图组件
import BmNavigation from 'vue-baidu-map/components/controls/Navigation' //　缩放组件
import BmMarker from 'vue-baidu-map/components/overlays/Marker' // 标记点的组件
import BmInfoWindow from 'vue-baidu-map/components/overlays/InfoWindow' // 信息窗体
import {
  getDataDicts,
  addProjectsInfo,
  getCustomerDicts,
  getAreadicts,
  getProjectManager,
  getProjectNum,
  getImCompany,
  getProjectsDel,
  getProjectFrom,
  getDepartConfig,
  addDepartmentConfig,
  getRegions,
  deleteProject,
  abbreviations
} from '@/api/project/projects'
import { getAuditAllProject } from '@/api/themeChoose/themeChoose'
import { getProjectypesList, getProjectypesOne } from '@/api/project/projectypes'
import { getImportantsList, getImportantsOne } from '@/api/project/importants'
import { getCustomerList, getCustomersOne } from '@/api/project/customers'
import { getTreeTypes, getMajorBranch } from '@/api/index'
import { getOrgUsers, getLabelTypes, getAllBranchCompany, getParentOrg } from '@/api/commons'
import { getContractUnitList } from '@/api/project/contracting'
import { getCompany } from '@/api/themeChoose/themeChoose'
import { getOneOrgUsers } from '@/api/commons'
import TreeSelect from './components/TreeSelect' // 【风险条件】专用
const columns = [
  {
    title: '序号',
    width: 65,
    scopedSlots: { customRender: 'serial' }
  },
  {
    title: '岗位名称',
    dataIndex: 'jobName',
    width: '30%',
    scopedSlots: { customRender: 'jobName' }
  },
  {
    title: '岗位人员姓名',
    width: '25%',
    scopedSlots: { customRender: 'employeeName' }
  },
  {
    title: '员工编号',
    width: '25%',
    scopedSlots: { customRender: 'employeeNum' }
  },
  {
    title: '操作',
    dataIndex: 'operation',
    scopedSlots: { customRender: 'operation' }
  }
]

const columnAssment = [
  {
    title: '序号',
    width: 65,
    dataIndex: 'serial',

    scopedSlots: { customRender: 'serial' }
  },
  {
    title: '附件名称',
    dataIndex: 'fileName',
    width: '15%'
  },
  {
    title: '附件格式',
    dataIndex: 'suffixName',
    width: '15%'
  },
  {
    title: '附件地址',
    dataIndex: 'rootPath',
    width: '40%'
  },
  {
    title: '操作',
    key: 'action',
    width: '20%',
    scopedSlots: { customRender: 'action' }
  }
]

const columnsDesign = [
  {
    title: '序号',
    width: 65,
    dataIndex: 'serial',

    scopedSlots: { customRender: 'serial' }
  },
  {
    title: '设计资源名称',
    dataIndex: 'name',
    width: '20%'
  },
  {
    title: '设计资源类型',
    dataIndex: 'resTypeName',
    width: '30%'
  },
  {
    title: '设计资源等级',
    dataIndex: 'resLevelName',
    width: '30%'
  }
]
export default {
  name: 'AddProjects',
  components: {
    AddAdJust,
    TreeSelect,
    BaiduMap,
    BmLocalSearch,
    BmMarker,
    BmNavigation,
    BmInfoWindow
  },
  props: {
    text: String
  },

  data() {
    // 校验社会统一信用代码
    const validator = (rule, value, callback) => {
      let reg = /^([0-9A-HJ-NPQRTUWXY]{2}\d{6}[0-9A-HJ-NPQRTUWXY]{10}|[1-9]\d{14})$/ //社会统一信用代码正则
      if (reg.test(value)) {
        callback()
      } else {
        callback(new Error())
      }
    }

    return {
      resSearchQuery: {}, // 设计资源搜索参数
      location: '',
      keyword: '',

      show: false,
      zoom: 13,
      lng: null,
      lat: null,
      mapAddress: '',
      visibleMap: false, // 地图

      tableData: [], //总数据
      totalSize: 0,
      totalPage: 0,
      pageNo: 1,
      pageSize: 10,

      searchArr: [
        // 搜索框
        {
          name: '设计资源名称',
          value: 'designResourceName',
          type: 'input'
        },
        {
          name: '设计资源类型',
          value: 'resTypeId',
          type: 'select',
          data: []
        },
        {
          name: '设计资源等级',
          value: 'resLevelId',
          type: 'select',
          data: []
        }
      ],

      visibles: false,

      isDelete: 0, // 若新增的项目 未保存草稿和提交是 点击关闭删除项目 0未删除  1删除
      loading: false,
      datas: [],

      processing: false,
      spinning: false,
      employeeMultiSelect: false, //员工多选
      columns,
      columnsDesign,
      columnAssment,
      onlyCompany: 0, // 只请求分公司
      form: {
        longitude: null,
        latitude: null,
        innerPackageCode: null,
        designUnitName: '',
        keyProjectsCode: undefined, // 是否为重点项目
        oneAreaCode: undefined,
        secondAreaCode: undefined,
        threeAreaCode: undefined,
        fourAreaCode: undefined,
        jurisdictionOneCode: undefined,
        jurisdictionTwoCode: undefined,
        engineeringTypeId: undefined,
        projectNatureId: undefined,
        undertakeCode: undefined,
        estimateTotalAmount: undefined,
        // 总承包项目
        epcProjectId: undefined,
        // 总承包项目是否内部项目
        epcIsInnerProject: 0,
        // 实施单位(所属三级单位)
        implementationThree: undefined,
        scopeIdList: [],
        riskCondition: [],  //  风险条件
        projectImportanceCode: null,
      },
      // 最高(长)单位工程米数(Km)名字
      engineeringMetersLabel: '最高(长)单位工程米数(Km)',
      rules: {
        contractModelCode: [{ required: true, message: '请选择工程承包模式', trigger: 'change' }],
        innerPackageCode: [{ required: true, message: '请选择承包类型', trigger: 'change' }],
        epcIsInnerProject: [{ required: true, message: '请选择总承包项目是否内部项目', trigger: 'change' }],
        contractBranchs: [{ required: true, message: '请选择专业承包公司', trigger: 'change' }],
        epcProjectId: [{ required: true, message: '请输入总承包项目', trigger: 'change' }],
        generalContractorCompanyName: [{ required: true, message: '请输入总承包单位', trigger: 'change' }],
        subContractAmount: [{ required: true, message: '请输入分包合同额', trigger: 'change' }],
        projectName: [{ required: true, message: '请输入项目备案名称', trigger: 'change' }],
        projectOmit: [{ required: true, message: '请输入项目简称', trigger: 'change' }],
        projectNum: [{ required: true, message: '请输入项目编号', trigger: 'change' }],
        winningTime: [{ required: true, message: '请选择中标时间', trigger: 'change' }],
        oneAreaCode: [{ required: true, message: '请选择一级地域', trigger: 'change' }],
        secondAreaCode: [{ required: true, message: '请选择二级地域', trigger: 'change' }],
        threeAreaCode: [{ required: true, message: '请选择三级地域', trigger: 'change' }],
        fourAreaCode: [{ required: true, message: '请选择四级地域', trigger: 'change' }],
        longitude: [{ required: true, message: '请输入经度', trigger: 'change' }],
        latitude: [{ required: true, message: '请输入纬度', trigger: 'change' }],
        projectAddress: [{ required: true, message: '请输入详细地址', trigger: 'change' }],
        jurisdictionOneCode: [{ required: true, message: '请选择区域一级管辖单位', trigger: 'change' }],
        // jurisdictionTwoCode:[{required: true, message: '请选择区域二级管辖单位', trigger: 'change'}],
        signUnitId: [{ required: true, message: '请选择签约单位', trigger: 'change' }],
        undertakeCode: [{ required: true, message: '请选择承接名义', trigger: 'change' }],
        implementationThree: [{ required: true, message: '请选择实施单位三级', trigger: 'change' }],
        projectTypeCode: [{ required: true, message: '请选择项目类型', trigger: 'change' }],
        projectFormatCode: [{ required: true, message: '请选择项目业态', trigger: 'change' }],
        structureTypeCode: [{ required: true, message: '请选择结构类型', trigger: 'change' }],
        projectImportanceCode: [{ required: true, message: '请选择项目重要程度', trigger: 'change' }],
        keyProjectsCode: [{ required: true, message: '请选择是否为重点项目', trigger: 'change' }],
        engineeringTypeId: [{ required: true, message: '请选择工程类型', trigger: 'change' }],
        projectNatureId: [{ required: true, message: '请选择工程性质', trigger: 'change' }],
        contractStartDate: [{ required: true, message: '请选择合同开工日期', trigger: 'change' }],
        contractEndDate: [{ required: true, message: '请选择合同竣工日期', trigger: 'change' }],
        bureauCustomerCode: [{ required: true, message: '请选择局级大客户', trigger: 'change' }],
        companyCustomerCode: [{ required: true, message: '请选择公司大客户', trigger: 'change' }],
        designUnitName: [{ required: true, message: '请输入设计单位名称', trigger: 'change' }],
        constructionName: [{ required: true, message: '请输入建设单位名称', trigger: 'change' }],
        constructionNatureCode: [{ required: true, message: '请选择建设单位性质', trigger: 'change' }],
        constructionCode: [{ required: true, message: '请输入正确的社会统一信用代码', trigger: 'change' }],
        contractCode: [{ required: true, message: '请选择是否签订合同', trigger: 'change' }],
        contractMileage: [{ required: true, message: '请输入合同工程里程', trigger: 'change' }],
        contractAreaGround: [{ required: true, message: '请输入合同建筑面积-地上(万m2)', trigger: 'change' }],
        contractAreaUnderground: [{ required: true, message: '请输入合同建筑面积-地下(万m2)', trigger: 'change' }],
        groundFloor: [{ required: true, message: '请输入地上层数', trigger: 'change' }],
        undergroundFloor: [{ required: true, message: '请输入地下层数', trigger: 'change' }],
        contractSingleProject: [{ required: true, message: '请输入合同单体工程个数', trigger: 'change' }],
        engineeringMeters: [{ required: true, message: `请输入${this.engineeringMetersLabel?this.engineeringMetersLabel:'最高(长)单位工程米数(Km)'}`, trigger: 'change' }],
        contractValue: [{ required: true, message: '请输入合同额(万)', trigger: 'change' }],
        ownerContractValue: [{ required: true, message: '请输入自有施工合同额(万)', trigger: 'change' }],
        estimateTotalAmount: [{ required: true, message: '请输入专业工程暂估价总额(万)', trigger: 'change' }],
        projectManager: [{ required: true, message: '请选择备案项目经理', trigger: 'change' }],
        projectFeatures: [{ required: true, message: '请输入项目特点或难点', trigger: 'change' }],
        scopeIdList: [{ required: true, message: '请选择主施工范围', trigger: 'change' }],
        mainScope: [{ required: true, message: '请输入主施工范围', trigger: 'change' }],
        excellencePlanCode: [{ required: true, message: '请选择计划创优级别', trigger: 'change' }],
        observePlanCode: [{ required: true, message: '请选择计划观摩级别', trigger: 'change' }],
        meritContentId: [{ required: true, message: '请选择计划创优内容', trigger: 'change' }],
        observeContent: [{ required: true, message: '请输入计划观摩内容', trigger: 'change' }]
      },

      // 附件上传
      listUrl: '/cscec-project-business/file/business/project-fileQuery',
      deleteUrl: '/cscec-project-business/file/business/project-fileDelete',
      uploadList: '/cscec-project-business/file/business/fileUpload',

      ungroundAreas: 0,
      totalArea: 0, // 合同建筑总面积
      groundAreas: 0, // 地上面积

      dataAssement: [],

      visible: false, // 人员配置调整
      confirmLoading: false,
      mdl: null, // 数据
      projectModecode: '', // 工程承包模式code
      projectModeId: '', // 工程承包模式
      isContract: false, // 专业承包分公司
      isGeneral: false, // 总承包公司

      editable: false,

      nextSteps: 1,
      preStep: 1,

      selectDatas: {}, // 立项返回下拉数据

      editingKey: '',
      selectedRowKeys: [],

      selectedRowKey: [],
      selectedRow: [],
      selectRow: [], // 设计单位名称选择

      value: 1, // 是否签订合同

      previewImage: '',

      // data:[{postName:'项目经理', employeeName:'张三',employeeNum:'231231'}],

      headers: {
        authorization: 'authorization-text'
      },
      queryParam: {
        projectName: '',
        name: ''
      },
      areaDicts: [],
      areaDicts1: [],
      areaDicts2: [],
      areaDicts3: [],
      areaDicts4: [],
      areaCode: '',
      typeNames: [],
      importantNames: [],
      isImportants: [
        { id: 0, name: '否' },
        { id: 1, name: '是' }
      ],
      customerName: [],
      projectManagers: [],
      bureauCustomers: [],
      companyCustomers: [],
      levelCode: '',
      managers: [],
      isContractMileage: false, // 线性基础数据
      isConstruction: true, // 房建
      managementLists: [], // 一级管辖单位
      agenciesLists: [], // 二级管辖单位
      threeCompany: [], // 实施单位三级
      projectForm: [], // 项目业态
      projectId: null, // 保存项目立项返回id
      isHaveProjectId: null, //  新增判断没有项目id
      oneAreaName: '', // 一级区域名称
      secondAreaName: '', // 二级区域名称
      threeAreaName: '', // 三级区域名称
      fourAreaName: '', // 四级区域名称
      projectManagerName: '', // 备案项目经理名称
      twoCompany: '', // 实施单位二级
      levelName: '', // 客户级别
      startDate: '', //  开始时间
      endDate: '', //    结束时间

      employeeNum: '', // 项目部设置人员调整员工编号
      employees: [], //设置的项目部人员信息

      projectPost: [], // 项目人员岗位设置
      otherPost: [], //  其他人员岗位设置

      contractingBranchs: [], // 专业承包分公司

      ispackage: '', // 是否外包

      isdiscontractMileage: false,

      objs: {
        businessId: '',
        code: '',
        commonFileId: ''
      },

      pageNumber: 1, // 调入人员分页
      pageSize1: 20, // 调入人员分页数量
      totalPages: 0, // 总页数

      company: [],
      implementationTwo: {},
      // 承接名义是否禁用
      undertakeCodeDisabled: false,
      // 面包屑名字
      breadcrumb: '',
      // 总承包项目列表
      epcIsInnerProjectList: [],
      companyList: [],
      // 项目备案名称记录
      projectName: '',
      // 项目简称记录
      projectOmit: '',
      bbreviationsArr: [],
      //获取流程配置值
      processConfig: null,
      //点击提交发送流程配置值
      setProcessConfig: null,
      businessId: null,
      //签约单位数据
      contractUnitList: [],
      //主施工范围
      mainScopeList: [],
      mainScopeText: [],
      // 【风险条件】控制【项目重要程度】是否可用的标识
      disabledByRiskCondition: true,
      // 【风险条件】控制【项目重要程度】列表的标识
      needFilterByRiskCondition: false,
    }
  },
  created() {
    this.finishPostSet = false // 是否已完成岗位人员设置，在这里初始化值

    this.spinning = true
    setTimeout(() => {
      this.getAreadicts()
    }, 10)
    this.getCompany()
    this.getProjectypesList()
    this.getImportantsList()
    this.getCustomerList()
    this.getProjectManager()
    this.getDataDicts()
    this.getCustomer()
    this.getCompanyDicts()
    this.getProjectFormat()
    this.getMajorBranch()
    this.getEpcIsInnerProjectList()
    this.abbreviationsFn()
    this.getContractUnitList()
    this.projectId = this.$route.query.projectId
    this.isHaveProjectId = this.$route.query.projectId
    // 新增时，【风险条件】默认为空，【项目重要程度】需要为【一般项目】
    if(!this.isHaveProjectId){
      this.controlByRiskCondition([]) //  传入空数组，主动进入 条件5 判断
    }
    
    this.businessId = this.projectId

    localStorage.setItem('projectId', this.projectId)

    let getProjectId = this.projectId
    if (getProjectId != null) {
      setTimeout(() => {
        this.getProjectDels(getProjectId)
        this.getDepartConfig() // 如果是编辑的话，需要获取项目部设置数据，判断是否已填写完必填项
      }, 20)
    } else {
      setTimeout(() => {
        this.spinning = false
      }, 1500)
    }
  },
  async mounted() {
    this.breadcrumb = this.$route.query.pageType === 'projectApproval' ? '合同信息编辑' : '编辑项目立项'
    //获取通过获取流程配置值
    this.processConfig = await this.$getConfigFn('project_approval')
  },
  computed: {
    importantNamesRenderList() {
      if(this.needFilterByRiskCondition){
        return this.importantNames.filter(item => ['局重点','公司重点'].includes(item.importantName))
      }

      return this.importantNames
      
    },
    hasSelected() {
      return this.selectedRowKeys.length > 0
    },
    // 经纬度的校验字段，根据值动态变化
    setFormProp() {
      if (!this.form.longitude && this.form.lepcIsInnerProjectongitude !== 0) {
        return 'longitude'
      } else {
        return 'latitude'
      }
    },
    // 区域一级管辖单位(所属办事处)
    setAreaProp() {
      const target = this.areaDicts.find((item) => item.id === this.form.oneAreaCode)
      if (target && target.name === '中国') {
        return 'jurisdictionOneCode'
      }
      if (this.$refs.form1) {
        // 一级地域切换到非中国时，清除表单校验状态
        this.$refs.form1.clearValidate('jurisdictionOneCode')
      }
      return 'jurisdictionOneCodeFake'
    },
    // 是否项目立项合同编辑
    isProjectApproval() {
      return this.$route.query.pageType === 'projectApproval'
    },
    // 总承包项目是否内部项目
    isEpcIsInnerProject() {
      return this.form.epcIsInnerProject === 1 && this.innerPackageCodeNot1
    },
    // 承包类型不等于内部承包
    innerPackageCodeNot1() {
      return this.form.innerPackageCode !== 1
    }
  },
  watch: {
    projectPost: {
      immediate: true,
      handler(list) {
        if (!list || !list.length) {
          return
        }
        // 更新项目部设置必填项的完成情况
        this.finishPostSet = list.every((item) => {
          return !item.requiredCode || (item.requiredCode && item.staffList && item.staffList.length)
        })
        console.log('this.finishPostSetthis.finishPostSet',this.finishPostSet)
      }
    },
    // 监听这边项目是否内部项目,为否时清空总承包项目
    'form.epcIsInnerProject': {
      handler(val) {
        if (this.form.innerPackageCode === 0) {
          if (val === 0) {
            this.form.epcProjectId = undefined
            this.companyList = this.company
          } else {
            // 新增的时候清空
            if (!this.projectId) {
              this.form.implementationThree = undefined
            }
            this.companyList = this.contractingBranchs
          }
        } else {
          this.companyList = this.company
        }
      }
    },
  },
  methods: {
    /**
     * 通过【风险条件】控制【项目重要程度】
     * 当手动修改【风险条件】时，needAssign 为 true，意为重新为【项目重要程度】赋值
     * 当编辑/查看详情时，needAssign 为 false，意为【项目重要程度】使用后台给的值
     */
    controlByRiskCondition(types, needAssign = true){
      // 一般项目："638572226488180736"
      // 小远散："638572122091954176"
      // 公司重点："638571893347196928"
      // 局重点："638571793568899072"

      this.needFilterByRiskCondition = false  //  只有条件2 需要过滤，因此在 条件2 单独改值
      // 条件1：当符合以下条件时，【项目重要程度】带出“局重点"不可修改
      //  1) 只要选择了条件T下的任一项
      if(types.includes("T")){
        if(needAssign){
          this.form.projectImportanceCode = "638571793568899072"  //  局重点
          this.getIsImpotant(this.form.projectImportanceCode) //  【项目重要程度】联动【是否为重点项目】
        }
        this.disabledByRiskCondition = true
        return
      }
      //  2) 同时选择了A1和B下的项
      if(types.includes("A1") && types.includes("B")){
        if(needAssign){
          this.form.projectImportanceCode = "638571793568899072"  //  局重点
          this.getIsImpotant(this.form.projectImportanceCode) //  【项目重要程度】联动【是否为重点项目】
        }
        this.disabledByRiskCondition = true
        return
      }

      // 条件2：当符合以下条件时，【项目重要程度】选择项为“局重点、公司重点";单选必填:T、A1、B中只选择了A1下的项
      if(types.includes("A1") && !types.includes("T") && !types.includes("B")){
        this.needFilterByRiskCondition = true
        if(needAssign){
          this.form.projectImportanceCode = null
          this.form.keyProjectsCode = null  //  【项目重要程度】联动【是否为重点项目】
          this.form.keyProjects = null
        }
        this.disabledByRiskCondition = false
        return
      }

      // 条件3：当符合以下条件时，【项目重要程度】带出“公司重点”不可修改: T、A1、B中只选择了B下的项
      if(types.includes("B") && !types.includes("T") && !types.includes("A1")){
        if(needAssign){
          this.form.projectImportanceCode = "638571893347196928"  //  公司重点
          this.getIsImpotant(this.form.projectImportanceCode) //  【项目重要程度】联动【是否为重点项目】
        }
        this.disabledByRiskCondition = true
        return
      }

      // 条件4：当符合以下条件时，【项目重要程度】带出“小远散”不可修改: T、A1、B都未逃择，选择了A2、距离、其他中的任一项，【项目重要程度】带出“小远散"不可修改;
      if(!types.includes("T") && 
         !types.includes("A1") && 
         !types.includes("B") && 
         (types.includes("A2") || types.includes("C") || types.includes("O"))
         ){
          if(needAssign){
            this.form.projectImportanceCode = "638572122091954176"  //  小远散
            this.getIsImpotant(this.form.projectImportanceCode) //  【项目重要程度】联动【是否为重点项目】
          }
        this.disabledByRiskCondition = true
        return
      }

      // 条件5：当都不选择时，【项目重要程度】带出“一般项目“不可修改
      if(types.length === 0){
        if(needAssign){
          this.form.projectImportanceCode = "638572226488180736"  //  一般项目
          this.getIsImpotant(this.form.projectImportanceCode) //  【项目重要程度】联动【是否为重点项目】
        }
        this.disabledByRiskCondition = true
        return
      }
    },
    // 获取【风险条件】选择项包含的 type，去重
    getRiskConditionType(riskCondition){
      let types = [];
      riskCondition.forEach(str => {
        const _temp = str.split(".")
          _temp[1] && types.push(_temp[1])
      })
      types = Array.from(new Set(types))
      return types
    },
    // 修改【风险条件】
    onRiskConditionChange(v){
      this.form.riskCondition = v
      const types = this.getRiskConditionType(v)
      this.controlByRiskCondition(types)

    },
    /**
     * @description: 获取签约单位列表
     * @return {void}
     */
    getContractUnitList() {
      getContractUnitList({needCount: false}).then(res => {
        let arr = [];
        res.data.map((item)=> {
          if(item.status!=='FALSE') arr.push(item)
        })
        this.contractUnitList = arr;
      })
    },
    
    abbreviationsFn() {
      abbreviations().then((res) => {
        if (res.code === 200) {
          this.abbreviationsArr = res.data
        }
      })
    },
    /**
     * @description: 获取总承包项目列表
     * @return {void}
     */
    getEpcIsInnerProjectList() {
      getAuditAllProject({ projectStatus: '1,2,3,4,5,6', excludeSubProject: 1 }).then((res) => {
        if (res.code === this.SUCCESS_CODE) {
          this.epcIsInnerProjectList = res.data
        }
      })
    },
    handleSearchManager(val) {
      this.pageNumber = 1
      this.getProjectManager(val)
    },
    /**
     * 区域一级管辖单位值被自动填充时，需要校验表单状态
     */
    handleOneCodeChanged() {
      this.$refs.form1.validateField('jurisdictionOneCode')
    },
    handleCancelMap() {
      this.visibleMap = false
    },

    handleOkMap() {
      this.visibleMap = false
      this.form.longitude = this.lng
      this.form.latitude = this.lat
      this.$refs.form1.validateField(['longitude', 'latitude'])
    },

    getMapModel() {
      this.visibleMap = true
      // this.keyword = ''
    },

    getLongitude(val) {
      this.form.longitude = val
    },

    getLatitude(val) {
      this.form.latitude = val
    },

    getLats(e) {
      let that = this
      if (that.form.longitude) {
        that.lng = that.form.longitude
      }

      if (that.form.latitude) {
        that.lat = that.form.latitude
      }

      var point = new BMap.Point(that.lng, that.lat)
      var gc = new BMap.Geocoder()
      var address = ''
      gc.getLocation(point, function (rs) {
        var addComp = rs.addressComponents
        address = addComp.province + addComp.city + addComp.district + addComp.street + addComp.streetNumber
        that.mapAddress = address
      })
    },

    // 获取当前点击的经纬度
    getLngLats(e) {
      this.lng = e.point.lng
      this.lat = e.point.lat
    },

    // 关闭标记详情
    infoWindowClose() {
      this.show = false
    },
    // 打开标记详情
    infoWindowOpen() {
      this.show = true
    },

    dataSources(val) {
      this.datas = val
    },
    getPopupContainer(triggerNode) {
      return triggerNode.parentNode
    },
    getCompany() {
      const userInfo = Vue.getAcloudProvider().getUserInfo()
      const code = userInfo?.currentPost?.code
      let that = this
      getAllBranchCompany({ tagCodes: ['BC'] }).then((res) => {
        that.company = [] // res.data
        const list = res.data || []
        // 公司级别的值可以选分公司
        if (code === 'CO') {
          this.company = list.map((item) => {
            return {
              orgId: item.id,
              orgName: item.name
            }
          })
          // 避免数据没加载完成
          if (this.form.innerPackageCode === 0) {
            if (this.form.epcIsInnerProject === 0) {
              this.companyList = this.company
            } else {
              this.companyList = this.contractingBranchs
            }
          } else {
            this.companyList = this.company
          }
          this.twoCompany = userInfo?.currentPost?.name
          that.implementationTwo = {
            key: userInfo?.currentPost?.id,
            label: userInfo?.currentPost?.name
          }
        }
        // 分公司级别的只可以选择岗位所在的分公司
        if (code === 'BC' && userInfo?.currentPost?.orgId) {
          this.company.push({
            orgId: userInfo?.currentPost?.orgId,
            orgName: userInfo?.currentPost?.orgName
          })
          this.companyList = this.company
          getParentOrg({ id: userInfo?.currentPost?.orgId }).then((res) => {
            const list = (res.data || []).filter((item) => item.tag === 'CO')
            if (list.length) {
              this.twoCompany = list[0].name
              this.implementationTwo = {
                key: list[0].id,
                label: list[0].name
              }
            }
          })
        }
      })
    },
    // 设计单位
    getTypes() {
      getLabelTypes({ type: 13 }).then((res) => {
        this.searchArr[2].data = this.getChangeDatatTypes(res.data)
      })

      getLabelTypes({ type: 14 }).then((res) => {
        this.searchArr[1].data = this.getChangeDatatTypes(res.data)
      })
    },

    changeData() {
      this.visibles = true
      this.getTypes()
      this.getDesignResourcesList()
    },
    handleCancels() {
      this.visibles = false
    },

    handleOks() {
      this.visibles = false
      this.form.designUnitName = this.selectRow.name
      this.form.designUnitId = this.selectRow.id
      this.$refs.form1.validateField('designUnitName')
    },

    onSelectChange(selectedRowKeys, selectedRows) {
      this.selectRow = selectedRows[0]
      this.selectedRowKey = selectedRowKeys
    },
    searchDatas(val) {
      this.pageNo = 1
      this.resSearchQuery = val || {}
      this.getDesignResourcesList()
    },

    handlePageChange(pageNo, pageSize) {
      this.pageNo = pageNo
      this.getDesignResourcesList()
    },
    showSizeChange(pageNo, pageSize) {
      this.pageNo = 1
      this.pageSize = pageSize
      this.getDesignResourcesList()
    },

    filterOption(input, option) {
      return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
    },

    // 备案经理 下拉滚动加载
    scrollMores(e) {
      const { target } = e
      var total = target.scrollTop + target.offsetHeight
      var scrollHeight = target.scrollHeight

      // this.pageNo是当前页 this.totalPage是总页数
      if (total >= scrollHeight - 3 && total < scrollHeight + 3 && this.pageNumber <= this.totalPages) {
        this.pageNumber = this.pageNumber + 1
        this.getProjectManager() // 调用api方法
      }
    },

    // 备案项目经理查询
    getProjectManager(val = '') {
      // delete: 0 不需要查询出已删除人员
      // getOrgUsers({
      //   queryPost: false,
      //   key: val,
      //   pageNumber: this.pageNumber,
      //   pageSize: val ? 99999 : this.pageSize1,
      //   delete: 0
      // }).then((res) => {
      //   if (res.data) {
      //     // 去重, 如果已存在，则不再添加
      //     let data = []
      //     res.data &&
      //       res.data.forEach((item) => {
      //         if (!this.projectManagers.filter((itemc) => item.id == itemc.id).length) {
      //           data.push(item)
      //         }
      //       })
      //     this.projectManagers = this.projectManagers.concat(data)
      //   }
      //   this.totalPages = res.totalPages
      // })
      getOneOrgUsers({
        queryPost: false,
        types: [0],
        pageNumber: this.pageNumber,
        pageSize: val ? 99999 : this.pageSize1
      }).then(({ list, total }) => {
        if (list) {
          // 去重, 如果已存在，则不再添加
          let data = []
          list &&
            list.forEach((item) => {
              if (!this.projectManagers.filter((itemc) => item.id == itemc.id).length) {
                data.push(item)
              }
            })
          this.projectManagers = this.projectManagers.concat(data)
        }
        this.totalPages = total
      })
    },

    // 设计单位名称
    scrollMore(e) {
      const { target } = e
      var total = target.scrollTop + target.offsetHeight
      var scrollHeight = target.scrollHeight

      // this.pageNo是当前页 this.totalPage是总页数
      if (total >= scrollHeight - 1 && total < scrollHeight + 1 && this.pageNo <= this.totalPage) {
        this.pageNo = this.pageNo + 1
        this.getDesignResourcesList() // 调用api方法
      }
    },
    getDesignResourcesList: function () {
      let searchData = Object.assign({ pageSize: this.pageSize, pageNo: this.pageNo }, this.resSearchQuery)
      getDesignResourcesList(searchData).then((res) => {
        if (res.code == 200) {
          this.tableData = res.data
          this.totalSize = res.totalSize
          this.totalPage = res.totalPage
        }
      })
    },
    getDesignUnitId() {
      const target = this.tableData.find((item) => item.name)
      this.form.designUnitId = target.id
    },
    goBack() {
      let that = this
      if (that.isDelete == 0 && (that.isHaveProjectId == undefined || that.isHaveProjectId == null)) {
        that.$confirm({
          title: '警告提醒！',
          content: '项目立项信息未保存草稿和提交，当前信息不在保存，确定关闭当前窗口？',
          okType: 'danger',
          onOk() {
            let proId = localStorage.getItem('projectId')
            if (proId != 'undefined') {
              deleteProject({ id: proId }).then((res) => {
                if (res.code == 200 || res.data.code == 200) {
                  that.$multiTab.close(that.$route.fullpath)
                }
              })
            } else {
              that.$multiTab.close(that.$route.fullpath)
            }
          },
          onCancel() {}
        })
      } else {
        that.$multiTab.close(that.$route.fullpath)
      }
    },
    getMajorBranch() {
      // BC
      getMajorBranch({ tagCodes: ['BC'], baseOrgType: 0 }).then((res) => {
        this.contractingBranchs = res.data
      })
    },
    saveDraft() {
      // 保存草稿
      this.isDelete = 1
      if ((this.form.innerPackageCode??'')==='') {
        this.$message.warning('请先选择承包类型！')
        this.nextSteps = 1
        return
      }
      if (!this.form.projectName) {
        this.$message.warning('请先填写项目备案名称！')
        this.nextSteps = 1
        return
      }
      if (!this.form.implementationThree) {
        this.$message.warning('请先填写实施单位(所属三级单位)！')
        this.nextSteps = 1
        return
      }

      if (this.nextSteps == 1) {
        if (this.processing) return
        this.processing = true
        this.form.implementationTwo = this.implementationTwo
        const params = this.$clone(this.form)
        // 承包类型内部承包时删除默认总承包项目是内部项目
        if (this.form.innerPackageCode === 1) {
          delete params.epcIsInnerProject
        }
        this.dataConversion(params);
        addProjectsInfo(params)
          .then((res) => {
            if (res.code == 200) {
              this.projectId = res.data.projectId
              this.businessId = this.projectId
              localStorage.setItem('projectId', res.data.projectId)
              this.$message.success('保存草稿成功！')
              this.$multiTab.close(this.$route.fullpath)
            } else {
              this.$message.error('保存草稿失败！')
            }
            this.processing = false
          })
          .catch(() => {
            this.processing = false
          })
      } else {
        this.$message.success('保存草稿成功！')
        this.$multiTab.close(this.$route.fullpath)
      }
    },
    submit() {
      if (!this.finishPostSet) {
        this.$warning({
          content: '请完善项目部设置'
        })
        return
      }
      // 提交
      this.isDelete = 1
      this.saveInfo(true)
    },
    groundArea(value) {
      this.groundAreas = value
      if (this.ungroundAreas != 0) {
        this.totalArea = parseFloat(this.ungroundAreas + value).toFixed(6)
      } else {
        this.totalArea = parseFloat(value).toFixed(6)
      }
    },
    ungroundArea(value) {
      this.ungroundAreas = value
      this.totalArea = parseFloat(this.groundAreas + value).toFixed(6)
    },
    employeeNums(val) {
      this.employeeNum = val
    },
    changeEmployees(val) {
      this.employees = val
    },
    handleEdit(record) {
      let _this = this
      _this.visible = true
      _this.employeeMultiSelect = !!record.numberLimitCode
      _this.datas = []
      _this.mdl = { ...record }
    },

    // 根据id获取项目详情信息
    /**
     * @description:
     * @param {string} getProjectId 项目id
     * @param {boolean} isInner 是否专业承包
     * @return {void}
     */
    getProjectDels(getProjectId, isInner = false) {
      this.spinning = true
      let that = this
      getProjectsDel({ projectId: getProjectId })
        .then((res) => {
          // 专业承包改变时
          if (isInner) {
            // 新增
            // if (!this.projectId) {
            //   this.form = {
            //     ...res.data,
            //     contractBranchs: this.form.contractBranchs,
            //     projectId: this.form.projectId,
            //     contractModelCode: this.form.contractModelCode,
            //     innerPackageCode: this.form.innerPackageCode,
            //     epcIsInnerProject: this.form.epcIsInnerProject,
            //     epcProjectId: this.form.epcProjectId,
            //     generalContractorCompanyName: res.data.projectName,
            //     implementationThree: undefined
            //   }
            //   this.projectName = this.form.projectName
            //   this.projectOmit = this.form.projectOmit
            // }
            this.form = {
              ...res.data,
              contractBranchs: this.form.contractBranchs,
              projectId: this.form.projectId,
              contractModelCode: this.form.contractModelCode,
              innerPackageCode: this.form.innerPackageCode,
              epcIsInnerProject: this.form.epcIsInnerProject,
              epcProjectId: this.form.epcProjectId,
              generalContractorCompanyName: res.data.projectName,
              implementationThree: undefined,
              riskCondition: res.data.riskCondition ? res.data.riskCondition.split(",") : []
            }
            const types = this.getRiskConditionType(this.form.riskCondition);
            this.controlByRiskCondition(types, false)

            this.projectName = this.form.projectName
            this.projectOmit = this.form.projectOmit
          } else {
            this.form = res.data
            this.form.riskCondition = res.data.riskCondition ? res.data.riskCondition.split(",") : []
            const types = this.getRiskConditionType(this.form.riskCondition);
            this.controlByRiskCondition(types, false)
            this.form.epcIsInnerProject = res.data.epcIsInnerProject ? 1 : 0
            if (!this.projectId) {
              this.form.generalContractorCompanyName = res.data.projectName
            }
          }
          // contractBranch  isContract   generalContractorCompanyName isGeneral

          if (that.form.contractModelCode == 'zycb' && that.form.innerPackageCode == 0) {
            that.isGeneral = true // 总承包
            that.isContract = false // 专业承包
          }
          if (that.form.contractModelCode == 'zycb' && that.form.innerPackageCode == 1) {
            that.isGeneral = false // 总承包
            that.isContract = true // 专业承包
          }
          if (that.form.contractModelCode != 'zycb' && that.form.innerPackageCode == 1) {
            that.isGeneral = false // 总承包
            that.isContract = true // 专业承包
          }
          if (that.form.contractModelCode != 'zycb' && that.form.innerPackageCode == 0) {
            that.isGeneral = false // 总承包
            that.isContract = false // 专业承包
          }
          // calculateTypeCode   // 项目类型计算方式

          if (that.form.calculateTypeCode == '0') {
            that.isContractMileage = false
            // that.isdiscontractMileage = false
            that.isConstruction = true
          } else {
            that.isContractMileage = true
            that.isConstruction = false
            // that.isdiscontractMileage = true
          }

          that.form.projectManager = {
            key: that.form.projectManagerCode,
            label: that.form.projectManagerName
          }
          if (!isInner) {
            that.form.implementationThree = {
              key: that.form.implementationThreeCode,
              label: that.form.implementationThreeName
            }
          }
          that.levelName = res.data.customerLevelName
          that.form.contractDays = res.data.contractDays

          that.totalArea = parseFloat(parseFloat(that.form.contractAreaGround) + parseFloat(that.form.contractAreaUnderground)).toFixed(6)

          if (that.form.secondAreaCode != '') {
            that.getRegions(that.form.secondAreaCode)
          }

          getTreeTypes({ query: { type: 1, parentId: null }, pageSize: 100 }).then((res) => {
            this.areaDicts = res.data
            // const area = {
            //   key: that.form.oneAreaCode,
            //   label: that.form.oneAreaName,
            // }
            // that.form.oneArea = { ...area }
          })

          that.form.oneAreaCode &&
            getTreeTypes({ query: { type: 1, parentId: that.form.oneAreaCode }, pageSize: 100 }).then((res) => {
              that.areaDicts2 = res.data
              // const area = {
              //   key: that.form.secondAreaCode,
              //   label: that.form.secondAreaName,
              // }
              // that.form.secondArea = { ...area }
            })

          that.form.secondAreaCode &&
            getTreeTypes({ query: { type: 1, parentId: that.form.secondAreaCode }, pageSize: 100 }).then((res) => {
              that.areaDicts3 = res.data
              // const area = {
              //   key: that.form.threeAreaCode,
              //   label: that.form.threeAreaName,
              // }
              // that.form.threeArea = { ...area }
            })

          that.form.threeAreaCode &&
            getTreeTypes({ query: { type: 1, parentId: that.form.threeAreaCode }, pageSize: 100 }).then((res) => {
              that.areaDicts4 = res.data
              // const area = {
              //   key: that.form.fourAreaCode,
              //   label: that.form.fourAreaName,
              // }
              // that.form.fourArea = { ...area }
            })

          that.selectChange(that.form.contractModelCode)
          that.isInnerPackage(that.form.innerPackageCode)
          that.getProType(that.form.projectTypeCode)
          that.selectUnit(that.form.projectTypeCode)
          setTimeout(() => {
            that.spinning = false
          }, 500)
        })
        .catch(() => {
          setTimeout(() => {
            that.spinning = false
          }, 500)
        })
    },
    selectUnit(code) {
     
      this.typeNames.map((item)=> {
        if(item.typeId == code) this.mainScopeList = item.scopeList;
      })
      let arr = []
      if(this.form.mainScope) {
        try {
          this.form.mainScope.split(';').map(item=> {
            const index = this.mainScopeList.findIndex(i=> i.scope === item)
            if (index !== -1) {
              arr.push(this.mainScopeList[index].id)
            }else {
              this.mainScopeList.push({
                id :'123',
                scope : item
              })
              arr.push('123')
            }
          });
          if (!this.form.scopeIdList) {
            this.form.scopeIdList = []
          }
          this.form.scopeIdList = arr;
        } catch (e) {
          console.log(e)
        }
      }
      this.mainScopeText = arr;
    },
    dataConversion(data) {
      let str = []
      if (this.form.scopeIdList && this.mainScopeList) {
        this.mainScopeList?.map(item=> {
          if(this.form.scopeIdList.indexOf(item.id) !== -1) str.push(item.scope);
        })
      }

      data.mainScope = str.join(';');
      data.scopeIdList?.map((item, index)=> {
        if(this.mainScopeText.findIndex(i=> {
          return i === item
        }) !== -1) {
          data.scopeIdList.splice(index, 1);
        }
      })
      data.riskCondition = data.riskCondition.join(",")
    },
    getDepartConfig() {
      // 项目岗位设置
      let proId = localStorage.getItem('projectId')
      getDepartConfig({ projectId: proId, projectJobType: 1, jobType: 0 }).then((res) => {
        this.projectPost = res.data.postConfigList
      })
    },
    getDepartConfigs() {
      // 其他岗位设置
      let proId = localStorage.getItem('projectId')
      getDepartConfig({ projectId: proId, projectJobType: 0, jobType: 0 }).then((res) => {
        this.otherPost = res.data.postConfigList
      })
    },
    getContractStartDate(value) {
      var d1 = new Date(value)
      var year = d1.getFullYear() //年
      var month = d1.getMonth() + 1 //月
      var day = d1.getDate() //日

      if (month < 10) {
        month = '0' + month
      }
      if (day < 10) {
        day = '0' + day
      }

      this.startDate = year + '-' + month + '-' + day
      this.form.contractStartDate = year + '-' + month + '-' + day

      if (this.form.contractEndDate != '' || this.form.contractEndDate != undefined) {
        this.endDate = this.form.contractEndDate
      }

      if (this.endDate != '' && this.endDate != undefined) {
        let startTime = new Date(this.startDate)
        let endTime = new Date(this.endDate)

        if (startTime > endTime) {
          this.$message.error('开工日期不能大于竣工日期！')
          this.form.contractStartDate = undefined
          return
        } else {
          let iDays = parseInt(Math.abs(endTime.getTime() - startTime.getTime()) / 1000 / 60 / 60 / 24)
          this.form.contractDays = iDays
        }
      }
    },
    getContractEndDate(value) {
      var d1 = new Date(value)
      var year = d1.getFullYear() //年
      var month = d1.getMonth() + 1 //月
      var day = d1.getDate() //日

      if (month < 10) {
        month = '0' + month
      }
      if (day < 10) {
        day = '0' + day
      }

      this.endDate = year + '-' + month + '-' + day
      this.form.contractEndDate = year + '-' + month + '-' + day

      if (this.form.contractStartDate != '' || this.form.contractStartDate != undefined) {
        this.startDate = this.form.contractStartDate
      }

      if (this.startDate != '' && this.startDate != undefined) {
        var startTime = new Date(this.startDate)
        var endTime = new Date(this.endDate)

        if (endTime < startTime) {
          this.$message.error('竣工日期不能小于开工日期！')
          this.form.contractEndDate = undefined
          return
        } else {
          let iDays = parseInt(Math.abs(endTime.getTime() - startTime.getTime()) / 1000 / 60 / 60 / 24)
          this.form.contractDays = iDays
        }
      }
    },
    handleCancel() {
      let _this = this
      _this.visible = false
      const form = _this.$refs.createModal.form
      form.resetFields() // 清理表单数据
    },
    handleOk() {
      const form = this.$refs.createModal.form
      if (true) {
        this.confirmLoading = true
        form.validateFields((errors, values) => {
          if (!errors) {
            values.projectId = this.mdl.projectId
            values.projectJobId = this.mdl.jobId
            values.staffList =
              (this.employees &&
                this.employees.map((e) => {
                  return { employeeNum: e.employeeNum, employee: { key: e.key, label: e.label } }
                })) ||
              []

            this.datas = this.datas
            addDepartmentConfig(values)
              .then((res) => {
                this.datas = []
                this.visible = false
                this.confirmLoading = false
                this.$message.success('设置成功')
                this.getDepartConfig()
                this.getDepartConfigs()
              })
              .catch((err) => {
                this.confirmLoading = false
              })
          } else {
            this.confirmLoading = false
          }
        })
      } else {
        this.visible = false
      }
    },

    edit(key) {
      const newData = [...this.data]
      const target = newData.filter((item) => key === item.key)[0]
      this.editingKey = key
      if (target) {
        target.editable = true
        this.data = newData
      }
    },

    getProType(value) {
      const target = this.typeNames.find((item) => item.typeId === value)
      this.mainScopeList = target.scopeList?target.scopeList:[]
      this.form.scopeIdList = []
      if (target.calculateTypeCode == '0') {
        this.isContractMileage = false
        // this.isdiscontractMileage = false
        this.isConstruction = true
      } else {
        this.isContractMileage = true
        // this.isdiscontractMileage = true
        this.isConstruction = false
      }
      // 项目类型为其他改变最高(长)单位工程米数字段名字
      if (value === '638571526815358976') {
        // 其他
        this.engineeringMetersLabel = '最高(长)单位工程米数(km)'
      } else if (value === '638571485077839872') {
        // 线性基础设施
        this.engineeringMetersLabel = '最长单位工程里程(km)'
      } else if (value === '638571399132356608') {
        // 房建
        this.engineeringMetersLabel = '最高单位工程米数(米)'
      } else {
        this.engineeringMetersLabel = '最高(长)单位工程米数(km)'
      }
    },
    getCustomer() {
      getCustomerDicts({ customerHierarchyCode: 1 }).then((res) => {
        this.bureauCustomers = res.data
      })
    },
    getCompanyDicts() {
      getCustomerDicts({ customerHierarchyCode: 2, pageNo: 1, pageSize: 999999 }).then((res) => {
        this.companyCustomers = res.data
      })
    },

    getLevelName(value) {
      let _this = this
      if (value == undefined) {
        _this.levelName = ''
        _this.form.customerLevelCode = ''
        return
      }
      getCustomersOne(value).then((res) => {
        _this.levelName = res.data.customerLevel
        _this.form.customerLevelCode = res.data.customerLevelCode // 传给客户级别的后台数据
      })
    },

    getProjectypesList() {
      getProjectypesList({ typeStatusCode: 1 }).then((res) => {
        this.typeNames = res.data
      })
    },
    getImportantsList() {
      getImportantsList({ importantStatusCode: 1 }).then((res) => {
        this.importantNames = res.data
      })
    },
    getIsImpotant(value) {
      getImportantsOne(value).then((res) => {
        this.form.keyProjectsCode = res.data.importantProjectCode
        this.form.keyProjects = res.data.importantProjectCode
      })
    },

    getCustomerList() {
      getCustomerList().then((res) => {
        this.customerName = res.data
      })
    },
    getDataDicts() {
      // 数据字典返回数据
      getDataDicts().then((res) => {
        this.selectDatas = res.data
      })
    },
    getAreaList(parentId) {
      return getTreeTypes({ query: { type: 1, parentId }, pageSize: 100 })
    },
    getAreadicts() {
      this.getAreaList(null).then((res) => {
        this.areaDicts = res.data
      })
    },
    // 选择一级区域查询二级区域
    getOneArea(value) {
      let that = this
      if (!value) {
        return
      }
      that.form.secondAreaCode = null
      that.form.threeAreaCode = null
      that.getAreaList(value).then((res) => {
        // that.areaCode = value
        const target = that.areaDicts.find((item) => item.id === value)
        that.form.oneAreaName = target.name
        that.areaDicts2 = res.data
      })
    },
    // 选择二级区域查询三级区域
    getTwoArea(value) {
      if (!value) {
        return
      }
      // this.form.jurisdictionOneCode = null
      this.form.jurisdictionTwoCode = null
      this.form.threeAreaCode = null
      this.form.fourAreaCode = null
      this.getAreaList(value).then((res) => {
        // this.areaCode = value.key
        const target = this.areaDicts2.find((item) => item.id === value)
        this.form.secondAreaName = target.name
        this.areaDicts3 = res.data
      })

      getRegions(value).then((res) => {
        this.managementLists = res.data.managementList
        this.agenciesLists = res.data.agenciesList
        this.form.jurisdictionOneCode = res.data.managementList[0]?.code
        this.handleOneCodeChanged()
      })
    },
    getRegions(value) {
      // 根据二级区域查询办事处
      getRegions(value).then((res) => {
        this.managementLists = res.data.managementList
        this.agenciesLists = res.data.agenciesList
      })
    },
    // 选择三级区域查询四级区域
    getThreeArea(value) {
      if (!value) {
        return
      }
      this.getAreaList(value).then((res) => {
        const target = this.areaDicts3.find((item) => item.id === value)
        this.form.threeAreaName = target.name
        this.areaDicts4 = res.data
      })
    },
    getFourArea(value) {
      if (!value) {
        return
      }

      const target = this.areaDicts4.find((item) => item.id === value)
      this.form.fourAreaName = target.name
    },

    getManagerName(value) {
      this.projectManagerName = value.label
    },

    getProjectFormat() {
      getProjectFrom().then((res) => {
        this.projectForm = res.data
      })
    },
    selectChange(value) {
      this.projectModeCode = value
      if (value != 'zycb' && this.ispackage == 0) {
        this.isGeneral = false // 总承包
        this.isContract = false // 专业承包
        // 总承包项目是否内部项目
        if (!this.projectId) {
          this.form.epcIsInnerProject = 0
        }
      }
      if (value == 'zycb' && this.ispackage == 0) {
        this.isGeneral = true // 总承包
        this.isContract = false // 专业承包
        // 总承包项目是否内部项目
        if (!this.projectId) {
          this.form.epcIsInnerProject = 1
        }
      }
    },
    isInnerPackage(value) {
      // 是否外包
      this.ispackage = value
      if (this.projectModeCode == 'zycb' && value == 0) {
        this.isGeneral = true // 总承包
        this.isContract = false // 专业承包
      }
      if (this.projectModeCode == 'zycb' && value == 1) {
        this.isGeneral = false // 总承包
        this.isContract = true // 专业承包
      }
      if (this.projectModeCode != 'zycb' && value == 1) {
        this.isGeneral = false // 总承包
        this.isContract = true // 专业承包
      }
      if (this.projectModeCode != 'zycb' && value == 0) {
        this.isGeneral = false // 总承包
        this.isContract = false // 专业承包
      }
      if (value == 1) {
        this.companyList = this.company
      } else {
        // 新增的时候清空
        if (!this.projectId) {
          this.form.implementationThree = undefined
        }
        if (this.projectModeCode == 'zycb') {
          this.companyList = this.contractingBranchs
        } else {
          this.companyList = this.company
        }
      }
    },
    callback(key) {
      let that = this
      this.preStep = this.nextSteps

      if (!that.form.projectName) {
        that.$message.error('请先填写项目备案名称！')
        that.nextSteps = 1
        return
      }

      if (!that.form.implementationThree) {
        that.$message.error('请先选择实施单位(所属三级单位)！')
        that.nextSteps = 1
        return
      }

      if (!that.projectId) {
        that.form.projectId = that.projectId
      }
      if (that.preStep === 1) {
        that.processing = true
        that.form.implementationTwo = that.implementationTwo
        let projectId = localStorage.getItem('projectId')
        if (projectId != 'undefined') {
          that.form.projectId = projectId
        }
        const params = this.$clone(that.form)
        // 承包类型内部承包时删除默认总承包项目是内部项目
        if (that.form.innerPackageCode === 1) {
          delete params.epcIsInnerProject
        }
        this.dataConversion(params);
        addProjectsInfo(params)
          .then((res) => {
            that.processing = false
            if (res.code == 200) {
              that.projectId = res.data.projectId
              that.businessId = res.data.projectId
              localStorage.setItem('projectId', res.data.projectId)
              that.$message.success('保存成功！')
              that.getDepartConfig()
              that.getDepartConfigs()
              // tabs切换
              this.nextSteps = key
            } else {
              this.nextSteps = 1
            }
          })
          .catch(() => {
            that.processing = false
            if (this.form.isSubmit) this.nextSteps = key
          })
      } else {
        let proId = localStorage.getItem('projectId')
        if (proId == undefined || proId == 'undefined' || proId == '') {
          this.nextSteps = that.preStep
        } else {
          this.nextSteps = key
        }
      }
    },
    nextStep() {
      // 下一步第一次遍历数据
      let that = this
      this.preStep = this.nextSteps
      if (this.nextSteps == 1) {
        if (that.form.projectName == '' || that.form.projectName == undefined) {
          that.$message.warning('请先填写项目备案名称！')
          return
        }

        if (that.form.implementationThree == '' || that.form.implementationThree == undefined) {
          that.$message.warning('请先选择实施单位(所属三级单位)！')
          return
        }

        that.processing = true
        if (that.projectId) {
          that.form.projectId = that.projectId
        }
        that.form.implementationTwo = that.implementationTwo
        const params = this.$clone(that.form)
        // 承包类型内部承包时删除默认总承包项目是内部项目
        if (that.form.innerPackageCode === 1) {
          delete params.epcIsInnerProject
        }
        this.dataConversion(params);
        addProjectsInfo(params)
          .then((res) => {
            if (res.code == 200 || res.data.code == 200) {
              that.processing = false
              that.projectId = res.data.projectId
              that.businessId = res.data.projectId
              localStorage.setItem('projectId', res.data.projectId)
              that.$message.success('保存成功！')
              that.getDepartConfig()
              that.getDepartConfigs()
              if (this.nextSteps == 3) {
                return
              }
              this.nextSteps++
            } else {
              that.processing = false
              that.$message.error(res.message)
            }
          })
          .catch((err) => {
            that.processing = false
          })
      } else {
        if (this.nextSteps == 3) {
          return
        }

        this.nextSteps++
      }
    },

    saveInfo(submit) {
      // 保存立项基本信息
      let _this = this
      _this.$refs.form1.validate((err, value) => {
        if (!err) {
          _this.$message.error('请先完善项目基本信息！')
          _this.nextSteps = 1
          return
        }
        _this.form.implementationTwo = _this.implementationTwo
        if (err) {
          if (!_this.form.implementationTwo.key) {
            _this.$warning({ content: '没有取得公司信息，请刷新重试' })
            return
          }
          if (_this.projectId) {
            _this.form.projectId = this.projectId
          }
          _this.processing = true
          _this.form.isSubmit = !!submit
          const params = this.$clone(_this.form)
          // 承包类型内部承包时删除默认总承包项目是内部项目
          if (_this.form.innerPackageCode === 1) {
            delete params.epcIsInnerProject
          }
          //
          this.dataConversion(params);
          this.submitApprovalConfirm(_this.processConfig, (flag)=>{
            if(!flag) {
              _this.processing = false
              return
            }
            if (params.scopeIdList){
              params.scopeIdList = params.scopeIdList.filter(v => v !== '123' )
            }
            addProjectsInfo(params)
                    .then((res) => {
                      if (res.code == 200) {
                        _this.projectId = res.data.projectId
                        localStorage.setItem('projectId', res.data.projectId)
                        _this.$message.success('提交成功！')
                        //提交时，返回id
                        _this.businessId = res.data.projectId
                        _this.setProcessConfig = _this.processConfig
                        // _this.$multiTab.close(_this.$route.fullpath)
                        if (!_this.form.isSubmit) {
                          _this.getDepartConfig()
                          _this.getDepartConfigs()
                        }
                      } else {
                        _this.$message.error('提交失败！')
                      }
                      _this.processing = false
                    })
                    .catch(() => {
                      _this.processing = false
                    })
          })

        }
      })
    },
    /**
     * @description: 根据签约单位输入项进行筛选
     * @param {string} input 输入值
     * @param {object} option 选项
     * @return {void}
     */
    contractUnitFilterOption(input, option) {
      return option.componentOptions.children[0].text.indexOf(input) >= 0
    },
    /**
     * @description: 签约单位改变承接名义
     * @param {string} value
     * @return {void}
     */
    contractUnitChange(value) {
      // 签约单位
      const defaultUnitList1 = ['中建八局西南建设工程有限公司', '中建八局两江建设有限公司', '中建八局（四川）建设有限公司']
      const defaultUnitList2 = ['中国建筑第八工程局有限公司']
      const defaultUnitList3 = ['中国建筑股份有限公司']
      const index = this.contractUnitList.findIndex((item)=> item.id==value)
      if (index >= 0) {
        const name = this.contractUnitList[index].name
        if (defaultUnitList1.indexOf(name) !== -1) {
          this.undertakeCodeDisabled = true
          this.form.undertakeCode = this.selectDatas.continuesTheNominal[0].code
        } else if(defaultUnitList2.indexOf(name) !== -1) {
          this.undertakeCodeDisabled = true
          this.form.undertakeCode = this.selectDatas.continuesTheNominal[1].code
        } else if(defaultUnitList3.indexOf(name) !== -1) {
          this.undertakeCodeDisabled = true
          this.form.undertakeCode = this.selectDatas.continuesTheNominal[2].code
        } else {
          this.undertakeCodeDisabled = false
          this.form.undertakeCode = ''
        }
      } else {
        this.undertakeCodeDisabled = false
        this.form.undertakeCode = ''
      }
    },
    /**
     * @description: 实施单位(所属三级单位)改变工程类型
     * @param {string} value
     * @return {void}
     */
    implementationThreeChange(value) {
      let findName = this.abbreviationsArr.find((item) => item.branchComId === value.key)
      if (this.isEpcIsInnerProject && findName) {
        this.form.projectName = `${this.projectName}(${findName.abbreviation})`
        this.form.projectOmit = `${this.projectOmit}(${findName.abbreviation})`
      }
      // if (value.key === 'ecf764c08dd94fa889ce31c380b1241c') {
      //   // 安装公司
      //   this.form.engineeringTypeId = '597645716827017568'
      //   this.engineeringTypeIdChange('597645716827017568')
      // } else if (value.key === 'cdcfa929b51a47269f336364860c9f0c') {
      //   // 装饰管理部
      //   this.form.engineeringTypeId = '597645716827017569'
      //   this.engineeringTypeIdChange('597645716827017569')
      // } else {
      //   // 其他
      //   this.form.engineeringTypeId = '597645716827017567'
      //   this.engineeringTypeIdChange('597645716827017567')
      // }
    },
    /**
     * @description: 工程类型改变工程性质
     * @param {string} value
     * @return {void}
     */
    engineeringTypeIdChange(value) {
      if (value === '597645716827017567') {
        // 土建
        this.form.projectNatureId = '597645716827017571'
      } else if (value === '597645716827017568') {
        // 安装对外
        this.form.projectNatureId = '597645716827017573'
      } else if (value === '597645716827017569') {
        // 装饰对外
        this.form.projectNatureId = '597645716827017575'
      }
    },
    /**
     * @description: 是否签订合同改变
     * @param {object} event事件对象
     * @return {void}
     */
    contractCodeChange(e) {
      if (e.target.value === 0) {
        this.$confirm({
          title: '提示',
          content: '未签订合同时，下方合同相关信息请填写预估信息',
          okType: 'danger'
        })
      }
    },
    /**
     * @description: 计算专业工程暂估价总额
     * @param {void}
     * @return {void}
     */
    calcEstimateTotalAmount() {
      const contractValue = typeof this.form.contractValue === 'number' ? this.form.contractValue : 0
      const ownerContractValue = typeof this.form.ownerContractValue === 'number' ? this.form.ownerContractValue : 0
      this.form.estimateTotalAmount = (contractValue - ownerContractValue).toFixed(2)
    },
    /**
     * @description: 总承包项目改变
     * @return {void}
     */
    handleEpcProjectIdChange(val) {
      if (val && this.form.epcIsInnerProject === 1) {
        this.getProjectDels(val, true)
      }
    },
    /**
     * @description: 总承包项目过滤
     * @return {boolean} 是否符合过滤条件
     */
    filterEpcProjectId(input, option) {
      return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
    }
  }
}
</script>
<style lang="less" scoped>
.bm-view {
  width: 100%;
  height: 500px;
}
.requireRed {
  color: red;
}
/deep/ .ant-form-item label {
  font-size: 12px;
}
</style>

